André Figueira

Systems engineer - I write apps, I make websites, opinions are my own...

Xdebug on Laravel Homestead with PHP 7

I recently wanted to setup xdebug for my Homestead box and I couldn't find any guides which matched the latest PHP 7 version. So I made this guide in case it helps others.

# Start up your Homestead VM
vagrant up

# Using the preinstall of PECL run the following command
sudo pecl install xdebug

# Create the xdebug.ini file 
sudo vi /etc/php/mods-available/xdebug.ini

# Paste in the following contents

xdebug.remote_enable = on
xdebug.remote_connect_back = on
xdebug.idekey = "PHPSTORM"

# Create symlink of the ini file to the PHP 7 conf.d folder
sudo ln -s /etc/php/mods-available/xdebug.ini /etc/php/7.0/fpm/conf.d/20-xdebug.ini

# Restart PHP
sudo service php7.0-fpm restart

Hopefully these steps will have worked for you, let me know in the comments if you had to change any part of this!