This page will contain useful information on installing and configuring the Apache web server.
Note: Linux + Apache + MySQL + PHP/Perl together commonly known as LAMP Server.
$ sudo apt-get update
$ sudo apt-get install apache2 php5 libapache2-mod-php5
Apache configuration file is located at: /etc/apache2/apache2.conf and your web folder is /var/www.
To check whether php is installed and running properly, just create a test.php in your /var/www folder with phpinfo() function:
<? phpinfo(); ? >
Check to see if apache2 is working. Point your browser at 127.0.0.1 or localhost. You should see “THIS WORKS!”. Check to see if PHP is working; point your browser at localhost/test.php. You should see a load of nice php info.
Delete test.php!!
If the test.php doesn't work restart apache and it should work then.
$ sudo /etc/init.d/apache2 restart
$ sudo apt-get install mysql-server mysql-client php5-mysql
You will be prompted to give mysql's root user a password.
$ sudo apt-get install phpmyadmin
The phpmyadmin configuration file is located at: /etc/phpmyadmin folder.
To set up under Apache all you need to do is include the following line in /etc/apache2/apache2.conf:
Include /etc/phpmyadmin/apache.conf
Restart Apache:
$ sudo /etc/init.d/apache2 restart
Now check localhost/phpmyadmin in your browser.
Modules allow you to add or remove functionality as dedictated by your requirements.
Looking at /etc/apache2/mods-enabled and /etc/apache2/mods-available will show you which mods you have and which are enabled.
Lets you use /home/<username>/public_html/ as webroot for http://<domain>/~<username>
$ sudo a2enmod userdir
Lets you rewrite ugly URLs with nicer one's.
$ sudo a2enmod rewrite
If you get this message when restarting apache
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
Add this line to the /etc/apache2/apache2.conf file and the error should be fixed
ServerName localhost
If you want to develop on Windows using a WAMP platform, I suggest you take a look at the XAMPP project (any platform, Apache, MySQL, PHP and phpMyAdmin). It makes setting up this whole thing a lot easier on Windows.