I'm trying to do some PHP profiling using Xdebug on a local environment. I'm running Ubuntu 22.04
I'm using PHP-FPM to run PHP v7.2 through a virtualhost.
php -v
outputs
Zend Engine v4.1.7, Copyright (c) Zend Technologies
with Zend OPcache v8.1.7, Copyright (c), by Zend Technologies
with Xdebug v3.1.4, Copyright (c) 2002-2022, by Derick Rethans
On /tmp/xdebug I've run
sudo chown $USER:$USER /tmp/xdebug
At the bottom of my /etc/php/7.2/fpm/php.ini
& /etc/php/8.1/apache2/php.ini
files I've put:
[xdebug]
zend_extension=xdebug
xdebug.output_dir = /tmp/xdebug
xdebug.remote_port=9001
xdebug.mode=develop,trace,profile
I then run
sudo systemctl restart apache2
The enabled Xdebug features are showing up in phpinfo()
in my main /localhost/ directory (using PHP 8.*), but not in the one using PHP 7.2
In my virtualhost .conf file I'm setting the PHP version like (I'm including this because I'm not sure if I need to do anything in this .conf file or not)
<FilesMatch \.php$>
# For Apache version 2.4.10 and above, use SetHandler to run PHP as a fastCGI process server
SetHandler "proxy:unix:/run/php/php7.2-fpm.sock|fcgi://localhost"
</FilesMatch>
The image below shows phpinfo()
picking up my Xdebug settings on PHP 8.*; the directory using PHP 7.2 shows no Xdebug settings enabled.
My question(s) / Issues:
- How do I get PHP 7.2 to recognize my Xdebug settings?
- How do I get Xdebug to output profile files to /tmp/xdebug? (I plan to use Webgrind)