0

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)

LazyOne
  • 158,824
  • 45
  • 388
  • 391
Alex
  • 5,510
  • 8
  • 35
  • 54
  • Show your whole `xdebug_info();` output captured via Apache. Maybe some changes are not getting applied there? Maybe Apache process does not have enough rights to write to that folder? (but if it makes Xdebug log there then it should not be an issue). No other ideas from me right now. P.S. `xdebug.remote_handler=dbgp;` -- that's Xdebug v2 and even there it doe snot do anything. – LazyOne Jun 09 '22 at 13:25

1 Answers1

1

I had the same problem. The solution was following:

In the service unit file the variable PrivateTmp was set to true:

 PrivateTmp=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