We're going to add the Dotdeb repository, which will provide the latest versions of Apache, PHP & MySQL for Debian. To do so, we need to modify the sources.list file by running the following command
nano /etc/apt/sources.list
If you get a command not found error, you first need to install the nano editor by running the following command
sudo apt-get install nano
Once you have sources.list file open, add the two following lines
deb http://packages.dotdeb.org stable all deb-src http://packages.dotdeb.org stable all
Now let's update the packet database to add those of Dotdeb. The version of Dotdeb packets being always superior to those of Debian, the Dotdeb versions will be automatically selected during the installation of Apache, PHP and MySQL.
After having added the Dotdeb repository, we can move on to installing Apache and PHP:
apt-get install apache2 php5 php5-mysql
The installations doesn't normally require any intervention on your behalf. Once this is finished, put in your server's address in your web browser: you should see a message saying "It works!", which means that Apache is working properly. Now let's test PHP by entering the following command:
echo "<?php phpinfo(); ?>" > /var/www/phpinfo.php
Then go to http://your_servers_ip/phpinfo.php: if PHP is working properly, you should see a page with the details of the configuration. If this isn't the case (for instance, if the server just sends the file with raw content: "<?php phpinfo(); ?>"), you need to restart Apache:
apache2ctl restart
…and try the URL again.
The Dotdeb version of PHP5 is compiled with the Suhosin patch. It allows, after having installed the php5-suhosin packet, to define numerous parameters related to PHP's security. More info on the project website's documentation.
Last modified: 07 Mar 2008 at 14:08 by Kosta K.