This page will contain useful information on installing and configuring the Apache web server.

Linux

  • Apache 2 - Linux Web server
  • MySQL 5 - MySQL Database Server
  • PHP4/5 - PHP Scripting Language
  • phpMyAdmin - Web-based database admin software.

Note: Linux + Apache + MySQL + PHP/Perl together commonly known as LAMP Server.

Apache2/PHP5

 
$ 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

MySQL

 
$ sudo apt-get install mysql-server mysql-client php5-mysql

You will be prompted to give mysql's root user a password.

PHPMyAdmin

 
$ 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.

Mods

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.

userdir

Lets you use /home/<username>/public_html/ as webroot for http://<domain>/~<username>

 
$ sudo a2enmod userdir

rewrite

Lets you rewrite ugly URLs with nicer one's.

 
$ sudo a2enmod rewrite

ServerName

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

Windows

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.

 
how_to/apache.txt · Last modified: 2008/05/19 09:45 by andrewjregan
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki