Apache not loading Xdebug, but does when started from the Command Line

馋奶兔 提交于 2019-12-08 16:33:34

问题


I know that this sounds odd, but believe me, it's what is happening. Here are my system settings:

Windows7
Apache 2.2
PHP 5.2.12
Xdebug 2.0.5

I have XDebug configured in my PHP.ini file. When I run php -m, I do in fact see that Xdebug is loaded. Now, if I start Apache AS A SERVICE (or by the Apache Monitor), and run phpinfo(), it is NOT showing Xdebug as being loaded.

However, (now here's the crazy part), if I go to my Apache bin directory, and simply run httpd.exe, and then go and look at phpinfo(), Xdebug now shows as being loaded!

Also, comparing some phpinfo() when started via service or by command line, it looks like the php.ini file is the same for either case. Everything looks the same except for the Xdebug being loaded part.

Please, if you have any ideas it would be greatly appreciated.


回答1:


I recently ran into the same issue, but I had to pinhole SELinux to allow httpd access to the xdebug.so module:

chcon -v -R --type=httpd_sys_content_t /path/to/your/xdebug.so

Restarted httpd and everything worked as expected.




回答2:


I had a similar problem with Xdebug in Windows/IIS - php -m showed the module as loaded, but phpinfo() did not. Turned out to be a permissions issue - once I set the xdebug .dll to give read access to anonymous users, it started working. I'd check permissions on that .dll to make sure that whatever user Apache is running as has access to it.




回答3:


Generally there is different configuration files for each possible way of invoking an instance of php: HTTP/CLI etc (at least this can be the case on *nix)

I would suggest doing a search on your system for php*ini and see if you have multiple files with differing/missing Xdebug settings.




回答4:


It's possibly a buggy version/combination. I had a different issue (XDebug was not recognising some variables), the problem cleared up when I when up to 2.1.0.

http://xdebug.org/download.php




回答5:


I had this problem and found out it was caused by having foward slashes in my php.ini instead of backslashes. So try: C:\php\ext\xdebug.dll instead of C:/php/ext/xdebug.dll




回答6:


Mike Purcell, you had it ALMOST right...

In new Red Hat and other Linux distributions the SELinux is enabled (sucks the big one) and blocks Apache spawned childs (such as xdebug.so) from doing certain things, like accessing the web.

Thus you need to disable SElinux using:

vi /etc/selinux/config 

SELINUX=disabled

so and reboot, this will disable SE Linux and X-Debug will begin working ... Killed a whole day cause of this, hope it helps someone..

This is also how Amazon EC2 and AWS Linux servers are setup...

Sean.



来源:https://stackoverflow.com/questions/2207489/apache-not-loading-xdebug-but-does-when-started-from-the-command-line

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!