Skip to content
Advertisement

Xdebug works on CLI but Apache wont load it

For the love of my life, I cannot figure this one out: I’ve compiled xdebug from source code and while the CLI will show me that it is active the webserver will not.

This is the process I went through.

JavaScript

Then I edited php.ini to include:

JavaScript

Followed by: apachectl restart

Here is the summary:

OS: Mac OS Big Sur 11.2.3 PHP: 7.3.24 Xdebug: 3.0.3

I’ve already checked that the zend_extension=location and the compiled module is there

The webserver is loading the correct php.ini There is only one php binary in my system.

There is no Brew setup here. I like to compile and install my own binaries to know what’s going on under the hood.

This is the output of for php -v

JavaScript

Here is php -i (removed non-relevant parts)

JavaScript

And this is the output for the headers in phpinfo() from the webserver with no mention of xdebug. Obviously, when trying to use xdebug functions through the webserver they will throw a fatal error since the functions are not defined.

JavaScript

Any ideas of what might be going on?

I’ve already looked at most other similar questions without luck.

Advertisement

Answer

After banging my head against the wall for a few hours, I was finally able to figure out what the problem was.

There was an error message about xcode not being code signed:

JavaScript

I was able to codesign it with my Apple Developer Certificate. However, after that the message changed to:

JavaScript

As it turns out, MacOS 11 requires library validation for everything. My solution, although not recommended if you don’t know what you are doing is to disable library validation systemwide for it be able to load.

You can do it with the following command:

JavaScript

Then you can restart apache and the module will load, after that you can reactivate library validation with

JavaScript

Happy debugging

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement