This little tutorial shows how to setup Apache, MySQL and PHP on a Linux server, in this case Ubuntu 12.04 LTS (by the way, if you want to know what LTS means, have a look into the wikipedia article) or Debian 7.0/7.1.
Most tutorials are making it overcomplicated, and beside that most commands (like apache restarting etc.) are not necessary anymore today. Log into your server…
1. Do an update and an upgrade to keep everything up-to-date:
sudo apt-get update sudo apt-get upgrade
2. Install Apache:
sudo apt-get install apache2
3. Install PHP:
sudo apt-get install php5
4. Install MySQL, mysql module for PHP and PDO stuff:
sudo apt-get install mysql-server sudo apt-get install php5-mysql
Provide a new mysql root password when asked. Then restart the server:
sudo service apache2 restart
By the way, then you think you messed something up while installing a package then you can remove the package and its config files via
sudo apt-get autoremove phpmyadmin
Have a look on your server to make sure Apache runs:
Cool ! Now let’s install PHPMyAdmin to make sure PHP and the MySQL server run and work together:
sudo apt-get install phpmyadmin
Select “apache2” when asked, select with SPACE and confirm with ENTER. Press ENTER when asked for auto-configuration and provide a new password for the phpmyadmin root user and mysql root passwords when asked for password (I use the same for this, to keep things simple). You don’t need to restart anything and there’s no need to config anything right now.
Have a look on PHPMyAdmin via
and you’ll see the phpmyadmin login screen. Log in to prove that everything runs fine.
NOTE: in a real live application you should not log into the server as the root user, not provide the root password to phpmyadmin and in general not have phpmyadmin available on the live server, but for a development server that’s totally okay.