I can trigger a PHP debug session (for both CLI and Apache) but when trying to profile it is working ONLY when in CLI mode and not under Apache2.
Here is my Xdebug configuration (xdebug.ini):
zend_extension=xdebug.so
xdebug.remote_handler=dbgp;
xdebug.mode=debug,profile;
xdebug.start_with_request=yes
xdebug.client_host=127.0.0.1;
xdebug.client_port=9003;
xdebug.discover_client_host = 1;
#xdebug.log_level=0;
#problems about xdebug profile itself
xdebug.log="/tmp/xdebugprofile/xdebug.log"
xdebug.output_dir = "/tmp/xdebugprofile";
xdebug.profiler_output_name = "cachegrind.out.%u.%H_%R";
Any idea of such inconsistent behavior?
(Linux Mint 20, PHP 8.0, Apache2)
I had the same problem. The solution was following:
In the service unit file the variable PrivateTmp was set to true:
I set the above to false and then restarted php-fpm
Possible locations of the file:
/usr/lib/systemd/system/php-fpm.service
/usr/lib/systemd/system/php72-php-fpm.service
You might find it using:
sudo find /usr/ -name php-fpm.service
Now cachegrind files were created in /tmp
Solution taken from: xdebug only profile php process not php-fpm process