Skip to content

Instantly share code, notes, and snippets.

@scribu
Created November 12, 2012 16:35
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scribu/4060355 to your computer and use it in GitHub Desktop.
Save scribu/4060355 to your computer and use it in GitHub Desktop.
Ubuntu PHP Dev Setup
#!/bin/bash
# LEMP
apt-get -y install nginx mysql-server php5-mysql php5-fpm
# extra php packages
apt-get -y install php5-cli php5-gd php5-curl php5-xdebug
# change user from www-data to scribu
sed -i 's/www-data/scribu/g' /etc/nginx/nginx.conf /etc/php5/fpm/pool.d/www.conf
# set up php-fpm socket
sed -i 's|127.0.0.1:9000|/var/run/phpfpm.sock|g' /etc/php5/fpm/pool.d/www.conf
sed -i 's|^;listen.owner|listen.owner|g' /etc/php5/fpm/pool.d/www.conf
sed -i 's|^;listen.group|listen.group|g' /etc/php5/fpm/pool.d/www.conf
sed -i 's|^;listen.mode|listen.mode|g' /etc/php5/fpm/pool.d/www.conf
# increase timeout
sed -i 's|max_execution_time = 30|max_input_time = 0|g' /etc/php5/fpm/php.ini
sed -i 's|max_input_time = 60|max_input_time = -1|g' /etc/php5/fpm/php.ini
cat > /etc/nginx/conf.d/php-debug.conf <<EOF
fastcgi_read_timeout 7200;
fastcgi_send_timeout 7200;
client_max_body_size 128m;
EOF
# increase max upload size
sed -i 's/memory_limit = 128M/memory_limit = 256M/g' /etc/php5/fpm/php.ini
sed -i 's/post_max_size = 8M/post_max_size = 128M/g' /etc/php5/fpm/php.ini
sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 128M/g' /etc/php5/fpm/php.ini
# enable html errors
sed -i 's/html_errors = Off/html_errors = On/g' /etc/php5/fpm/php.ini
# set up xdebug remote
xdebug=<<EOF
[xdebug]
xdebug.remote_enable = 1
xdebug.remote_autostart=1
xdebug.remote_port = 9009
EOF
echo $xdebug >> /etc/php5/fpm/php.ini
echo $xdebug >> /etc/php5/cli/php.ini
service php5-fpm restart
service nginx restart
# PEAR
apt-get -y install php-pear
pear upgrade pear
# PHPUnit
pear channel-discover pear.phpunit.de
pear channel-discover components.ez.no
pear channel-discover pear.symfony.com
pear install --alldeps phpunit/PHPUnit
@ryross
Copy link

ryross commented Aug 2, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment