Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

My PHP-CPP Extension run perfectly in terminal but show errors in the browser #330

Open
Muhammad-Mubeen opened this issue Apr 26, 2017 · 16 comments

Comments

@Muhammad-Mubeen
Copy link

My PHP-CPP extension is running perfectly in the terminal but when it try to does not show output in the browser. Can anyone tell me what's the problem.? Here is the screenshot
sc

@sjinks
Copy link
Contributor

sjinks commented Apr 26, 2017

Have you restarted your web server after (re)installing your extension?

@hugdx
Copy link

hugdx commented Apr 27, 2017

please post your phpinfo() and php error log when you run with browser

@Muhammad-Mubeen
Copy link
Author

@sjinks yes i did that. But there are still issues.

@Muhammad-Mubeen
Copy link
Author

Muhammad-Mubeen commented Apr 27, 2017

@hugdx here is my php code and error message. It shows error when i call the function or object form the cpp file.

         `<?php
	          ini_set('display_errors', 1);
	          ini_set('display_startup_errors', 1);
	          error_reporting(E_ALL);
	          echo "string";
	          $obj = new item();
	          $obj->DBconnect();  
	          echo "string";
            ?>`

capture

@hugdx
Copy link

hugdx commented Apr 27, 2017

@Muhammad-Mubeen can you create a php file with name phpinfo.php and content:

<?php
phpinfo();
?>

after that, please run this file and post results to here

@Muhammad-Mubeen
Copy link
Author

Muhammad-Mubeen commented Apr 27, 2017

@hugdx Here are the results
ac

@hugdx
Copy link

hugdx commented Apr 27, 2017

Please try:

  1. Make sure your extension is loaded (via phpinfo() function)
  2. Check php errors log
  3. If still not resolve your issue, post your code (c++) to here

If you want i help from me, please post your skype here, i can help you via teamviewer

@Muhammad-Mubeen
Copy link
Author

Muhammad-Mubeen commented Apr 28, 2017

@hugdx i tried the different solutions again but still the same issues. can you come on skype? here is my skype ID: mohammad-mubeen1

@Muhammad-Mubeen
Copy link
Author

@hugdx phpinfo() is showing the extension in it but still its not working,

@hugdx
Copy link

hugdx commented May 2, 2017

@Muhammad-Mubeen i added you via skype.

@vdeurzen
Copy link

@hugdx I am having a similar issue. I implemented the example dynamic loading module and when used from the commandline everything works just fine. However, when used through apache2 it does not seem to work correctly. Any advice?

@Muhammad-Mubeen
Copy link
Author

@vdeurzen In your Makefile replace

INI_DIR = /etc/php5/conf.d

with

INI_DIR = /etc/fpm/conf.d

Hope it will work

@vdeurzen
Copy link

@Muhammad-Mubeen We are not using FPM at this time, we are (afaik) still using mod_php5 -.-'
What was the underlying problem here? Was it to do with FPM or something deeper?

@Muhammad-Mubeen
Copy link
Author

@vdeurzen In my case, the real problem was with FPM folder. Becuase when you are going to run your program in the browser, it is necessary to make the file in FPM folder.

@gnat42
Copy link
Contributor

gnat42 commented Nov 17, 2017

I have the same issue - Removing xdebug makes it work in both browser and cli. I can't figure out why with xdebug it works on the cli but not the browser...

@gnat42
Copy link
Contributor

gnat42 commented Nov 17, 2017

I have been able to determine that when I have xdebug loaded my class suddenly is declared in the wrong namespace.

For example, my classes are in the PDF namespace and I have a PDFDocument class. Without xdebug loaded get_declared_classes outputs...

...
[182] => PDF\PdfImageResult
[183] => PDF\PdfDocument
[184] => PDF\PdfText
[185] => PDF\PdfWriter
...

with Xdebug I get

...
[182] => PDF\PDF\PdfImageResult
[183] => PDF\PDF\PdfDocument
[184] => PDF\PDF\PdfText
[185] => PDF\PDF\PdfWriter
...

Still trying to figure out why this is the case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants