Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

php

apache

xdebug

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.

like image 585
JamesD Avatar asked Feb 05 '10 13:02

JamesD


People also ask

How do I know if Xdebug is working?

Verify that Xdebug is properly running by checking again with phpinfo() or php -v as explained above. Note that 9003 is the default port. If this port is used by another service on your system, change it to an unused port. After adding these settings, restart your webserver again.

Where can I find Xdebug ini?

Alternatively, you can run php --ini on the command line. If there is a file with xdebug in the name, such as /etc/php/7.4/cli/conf. d/99-xdebug. ini , then this is the file to use.


1 Answers

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.

like image 164
Mike Purcell Avatar answered Sep 30 '22 03:09

Mike Purcell