zepgram / magento2-fast-vm

Optimal vagrant developer box for Magento2. Folders synced by nfs/rsync. This box includes Magento developer utilities.
MIT License
110 stars 35 forks source link

xdebug installation #45

Closed swaibar closed 4 years ago

swaibar commented 4 years ago

Hi, I have setup this skeleton to easily debug on my localhost a magento installation. However after following the instructions from https://xdebug.org/wizard and use the following steps but when done I do not see the xdebug either php -v or via http://192.168.200.0/php/

sudo apt-get install php-dev autoconf automake
curl -O http://xdebug.org/files/xdebug-2.9.0.tgz
tar -xvzf xdebug-2.9.0.tgz
cd xdebug-2.9.0
phpize
./configure
make
sudo cp modules/xdebug.so /usr/lib/php/20180731
echo 'zend_extension = /usr/lib/php/20180731/xdebug.so' | sudo tee -a /etc/php/7.3/fpm/php.ini

and then restart nginx and php-fpm

sudo /etc/init.d/nginx restart
sudo /etc/init.d/php7.3-fpm restart

any help would be much appreciated!

zepgram commented 4 years ago

Could you check if extension is enabled ? There is a phpinfo : http://#{network_ip}/php Also, opcache is enabled, so according to doc you should modify php.ini:

Add the following line to php.ini:

zend_extension="/wherever/you/put/it/xdebug.so"

Note: If you want to use Xdebug and OPCache together, you must have the zend_extension line for Xdebug after the line for OPCache. Otherwise, they won't work properly.

swaibar commented 4 years ago

I did already check the phpinfo : http://#{network_ip}/php...

when done I do not see the xdebug either php -v or via http://192.168.200.0/php/

And "you should modify php.ini" - I did modify php ini please see this line....

echo 'zend_extension = /usr/lib/php/20180731/xdebug.so' | sudo tee -a /etc/php/7.3/fpm/php.ini

...this appends the string zend_extension = /usr/lib/php/20180731/xdebug.so to the end of the php ini file. As it is at the end it is after the opcache lines.

Something isn't right with getting the php.ini settings used... I've just tried turning off the opcache and that had no effect. The php file is certainly the one as I've added phpinfo();die(); to pub/errors/404.php so there must be something wrong with how I am applying/restarting it or the php.ini file.

Is there anything wrong with this? Or additional ini files being read?

sudo /etc/init.d/nginx restart
sudo /etc/init.d/php7.3-fpm restart
zepgram commented 4 years ago

It worked for me with apt installation sudo apt install php-xdebug according to this: https://drupaland.eu/article/installing-and-enabling-xdebug-debian-9 image

swaibar commented 4 years ago

do you know sudo apt install php-xdebug is slightly better than what I had, thank you!