Xdebug in Vagrant laravel / homestead V0.4.0 / v3.0.1

I installed the roaming box laravel / homestead v0.4.0.
I install homestead V3.0.1 using composer.
Finally, I run "roaming" and then "roaming ssh", and I'm inside the Homestead VM, but ...

It should include Xdebug , but it does not ... When I run phpinfo() , Xdebug information is missing.
Also in /etc/php/7.0/fpm/php.ini or in the config.d folder config.d are no configurations for Xdebug.

My ultimate goal is to debug a laravel project using the Netbeans IDE. The project is executed inside the Homestead virtual machine, but they managed to understand why Xdebug is not in the estate virtual machine. Any help to achieve this is much appreciated.

+5
source share
3 answers

EDIT: Starting with version 0.4.1, XDebug has been put back in Homestead. Compiling XDebug from the source is no longer required.


Your ~/.homestead should have a file named after.sh . This will provide you with a means by which you can execute your own commands after the Homestead provisioning tool has finished.

Copy and paste the following into your after.sh file:

 #!/bin/sh # Install Xdebug git clone git://github.com/xdebug/xdebug.git cd xdebug phpize ./configure --enable-xdebug make make install # Configure Xdebug cat > /etc/php/mods-available/xdebug.ini <<EOL zend_extension=xdebug.so xdebug.default_enable=1 xdebug.remote_enable=1 xdebug.remote_port=9000 xdebug.remote_autostart=1 xdebug.remote_connect_back=1 EOL ln -s /etc/php/mods-available/xdebug.ini /etc/php/7.0/fpm/conf.d/20-xdebug.ini service php7.0-fpm restart 

When finished, run vagrant destroy and vagrant up or run vagrant provision to verify that the shell command is executed correctly.

This version of XDebug is a direct clone of the Github Master branch. This branch is considered unstable. After the github Xdebug account adds a branch for 2.4 or 2.5, be sure to update your shell command to check this branch before running various configurations and commands.

In addition, I am adding Xdebug to the FPM configuration. I do not add it to the CLI configuration . You will probably see Xdebug only in the phpinfo() call, not in the php -i call.

In addition, I tested this in my own environment:

  • Manor version 0.4
  • Github clone laravel / homestead 3.0.1
  • PHPStorm IDE

Everything works as expected. Let me know if this helps.

+5
source

Just run it on your manor

 php -v sudo phpenmod xdebug sudo service nginx restart 
+4
source

This is all you need in ~ / .homestead / after.sh:

 #!/bin/sh # If you would like to do some extra provisioning you may # add any commands you wish to this file and they will # be run after the Homestead machine is provisioned. apt-get install php-xdebug 
0
source

Source: https://habr.com/ru/post/1239315/


All Articles