Skip to content

Instantly share code, notes, and snippets.

Forked from kbond/
Last active July 18, 2023 09:13
Show Gist options
  • Save antfroger/e3709b980024a65c8b36 to your computer and use it in GitHub Desktop.
Save antfroger/e3709b980024a65c8b36 to your computer and use it in GitHub Desktop.
Ubuntu LAMP Development Environment Setup

Install apache/php:

sudo apt-get install apache2 php5 php5-cli libapache2-mod-php5 php5-dev

Ensure this worked by visiting http://localhost/. You should see It works!.

Install useful php modules:

sudo apt-get install php5-mcrypt php5-xdebug php5-curl php5-sqlite php5-xsl php-pear php-apc php5-intl
sudo pear install --alldeps PHP_CodeSniffer

Edit your php.ini:

sudo vim /etc/php5/apache2/php.ini
  1. Add a timezone

     date.timezone = Europe/Paris
  2. Edit error configuration

     error_reporting = E_ALL
     display_errors = On
     display_startup_errors = On

Install mysql (enter through password prompts to use use defaults):

sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql

Install phpmyadmin (choose apache2 and enter through password prompts to use default):

sudo apt-get install phpmyadmin

Edit phpmyadmin

sudo vim /etc/phpmyadmin/

Add/edit the following (around page 42):

// ...

/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'config';

$cfg['Servers'][$i]['AllowNoPassword'] = TRUE;
$cfg['Servers'][$i]['user'] = 'root';
/* Server parameters */

// ...

Ensure this worked by visiting http://localhost/phpmyadmin

Edit /etc/php5/mods-available/xdebug.ini:

xdebug.remote_autostart = 1

xdebug.max_nesting_level = 500

;xdebug.profiler_enable = 1
xdebug.profiler_output_dir = /tmp/xdebug/
xdebug.profiler_enable_trigger = 1

Install git:

sudo apt-get install git

Configure Git:

touch ~/.gitignore_global
git config --global core.excludesfile ~/.gitignore
git config --global "Your Name"
git config --global "Your Email"

ssh-keygen -t rsa -C "Your Email"
cat ~/.ssh/

Add in ~/.gitignore

# PHPStorm files


Install Composer:

sudo apt-get install curl
curl -sS | php
sudo mv composer.phar /usr/local/bin/composer

Install PHPUnit:

composer global require "phpunit/phpunit=*"

Add the directory where the tool is installed to your path:

export PATH=~/.composer/vendor/bin:$PATH

Install node.js/npm:

sudo apt-get install python-software-properties python g++ make
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs

Install some npm modules:

sudo npm install -g bower
sudo npm install -g uglify-js
sudo npm install -g uglifycss
sudo npm install -g grunt-cli
sudo npm install -g zombie


A. Configure bash


Create a .bash_aliases file

touch ~/.bash_aliases

Add your aliases

alias g='git'
alias c='composer'

Add in ~/.bashrc

if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases

Enable git autocompletion

Add in ~/.bashrc

source /usr/share/bash-completion/completions/git
complete -o default -o nospace -F _git g

B. Configure Apache Sites

Enable Apache mods:

sudo a2enmod rewrite vhost_alias

Add Apache site:

sudo vim /etc/apache2/sites-available/010-dev.conf

Add the following:

UseCanonicalName Off
VirtualDocumentRoot /home/antoine/www/%2/%1/web/
# is located in the directory /home/antoine/www/dev/mysite/

Enable the site:

sudo a2ensite 010-dev.conf

Allow access through the web browser to your files. Add in /etc/apache2/apache2.conf:

<Directory /home/antoine/www/>
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted

Restart Apache:

sudo apache2ctl restart

Ensure your sites are added to /etc/hosts:

C. Enable SSL

Install ssl-cert:

sudo apt-get install ssl-cert

Enable ssl and default ssl site in apache:

sudo a2enmod ssl
sudo a2ensite default-ssl
sudo service apache2 restart

D. Enable ACL

Edit your filesystem table:

sudo vim /etc/fstab

Add acl to the options column of ext4:

# <file system>  <mount point>  <type>  <options>              <dump>  <pass>
UUID=...         /              ext4    acl,errors=remount-ro  0       1

E. Install icu/php-intl from source

Download latest ICU

make install

Download latest intl

make install

Add the following to your php.ini:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment