Skip to content

Instantly share code, notes, and snippets.

@mgussekloo
Forked from berkayunal/after.sh
Created April 25, 2018 09:29
Show Gist options
  • Save mgussekloo/688d83d8d7830cd0d00de10f60b00a51 to your computer and use it in GitHub Desktop.
Save mgussekloo/688d83d8d7830cd0d00de10f60b00a51 to your computer and use it in GitHub Desktop.
Laravel Homestead after.sh placed 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.
echo "Updating machine software"
locale-gen en_GB.UTF-8
# Updating composer
composer self-update
# Updating and upgrading dependencies
apt-get update && apt-get upgrade -y
# Installing PHPUnit
apt-get install phpunit -y
echo "Configuring extra machine software"
# Adding configuration params to xdebug.ini
# xdebug.remote_host = 192.168.##.## as vm see's your host.
xdebug="zend_extension=xdebug.so
xdebug.max_nesting_level=300
xdebug.remote_enable=1
xdebug.remote_connect_back=0
xdebug.remote_port=9000
xdebug.scream=0
xdebug.cli_color=1
xdebug.remote_host=192.168.10.1
xdebug.remote_autostart=1
xdebug.show_local_vars=1
xdebug.idekey=PHPSTORM
xdebug.remote_log=/tmp/xdebug.log
xdebug.remote_handler=dbgp
"
echo "$xdebug" > "/etc/php5/mods-available/xdebug.ini"
# Adding configuration to ~/.profile file
profile='export PHP_IDE_CONFIG="serverName=vagrant"
export XDEBUG_CONFIG="idekey=PHPSTORM remote_host=192.168.10.1 profiler_enable=1"'
echo "$profile" >> "/home/vagrant/.profile"
echo "Disabling/Enabling things that will make this work"
# Disabling Blackfire PHP module
sudo php5dismod blackfire
# Enabling Xdebug PHP module
sudo php5enmod xdebug
# Generating a appliying proper permissions to xdebug log file
sudo touch /tmp/xdebug.log
sudo chown vagrant:vagrant /tmp/xdebug.log
sudo chmod 777 /tmp/xdebug.log
# Restarting PHP-FPM
service php5-fpm restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment