prepare ubuntu for PHP development

How to configure LAMP on your ubuntu 16.04 workstation

Steps to reproduce on ubuntu 16.04

  • install package
  • edit /etc/apache2/envvars to set APACHE_RUN_USER && APACHE_RUN_GROUP to your USERNAME
  • restart apache
  • give to your user ownership of /var/www/html/
  • test with phpinfo() in a test.php file
sudo apt-get install apache2 php mysql-server libapache2-mod-php php-mysql
sudo gedit /etc/apache2/envvars
sudo service apache2 restart
sudo chown -R USERNAME:USERNAME /var/www/html
echo "<?php phpinfo(); ?>" > /var/www/html/info.php

then test : http://localhost/info.php