This tutorial will help you install xdebug and webgrind profiling. PHP is NOT running as PHP-FPM.
apt update
apt install php-dev
cd ~
git clone https://github.com/xdebug/xdebug.git
cd xdebug
./rebuild.sh
Notes:
- the
./rebuild.sh
shell file is runningphpize
,./configure --enable-xdebug
,make
andmake install
in the background. - in my case, the
xdebug.so
file was installed in/usr/lib/php/20151012/
folder
echo "extension=xdebug.so" > /etc/php/7.0/mods-available/xdebug.ini
ln -s /etc/php/7.0/mods-available/xdebug.ini /etc/php/7.0/apache2/conf.d/xdebug.ini
service apache2 restart
To test the installation, create a php file and put phpinfo
in it. In the output there should be xdebug.
In .htaccess file, paste the following:
php_value xdebug.profiler_enable 1
Now, on every request Xdebug will create a cachegrind.out.
in /tmp
folder that can be read by Webgrind.
Additional information about the configuration can be found on https://xdebug.org/docs/profiler.
cd /var/www/html
wget https://github.com/jokkedk/webgrind/archive/v1.6.0.zip
unzip v1.6.0.zip
Now you can access Webgrind from the browser by accessing http://<your_ip>/webgrind-1.6.0/
https://github.com/xdebug/xdebug
https://github.com/jokkedk/webgrind