Plesk, Debian, PHP5

Here is a way to get PHP5 up and running on your Debian Plesk
system.

There is probably a better way of doing this but I haven’t yet found a way that doesn’t cause apt to remove the plesk packages (as they depend on php4). This method leaves the PHP4 packages on the server - the packages in the dexter repository behave differently than others I have tried.

You will need to SSH to your server using an SSH client

Login and use command ’su’ to change to the root user.

Step 1
Edit your /etc/apt/sources.list file using your favorite editor. For
example:

#joe /etc/apt/sources.list

Then add:
deb http://people.debian.org/~dexter php5 sarge

To the end of the file

Step 2
Update your sources with the following command

#apt-get update

Step 3
Install PHP5 using apt-get (add or remove the packages you require)
#apt-get install php5 libapache2-mod-php5 php5-mysql php5-curl php5-gd php5-session php5-imap

Step 4
You will now have both PHP4 and PHP5 installed in to your apache
configuration.

Temporarily remove PHP4 from your apache configuration while you check everything is working

Remove the symlinks in mods-enabled. You can re-create them from
mods-available if you need to switch back to php4

rm /etc/apache2/mods-enabled/php4*

Step 5
Restart apache2
#/etc/init.d/apache2 restart

That’s it! Test your installation by calling phpinfo(); from within a
PHP script.

2 Comments so far

  1. Akis Maziotis on September 19th, 2007

    Thank you very mutch for this!
    Worked like a charm :)

    Akis

  2. shahbaz on June 18th, 2008

    adding
    deb http://people.debian.org/~dexter php5 sarge
    in /etc/apt/sources.list give the error..
    it is better to just apt-get update and then upgrade php using
    apt-get install psa-php5-configurator php5 libapache2-mod-php5 php5-cli php5-common php5-curl php5-gd php5-imap php5-mysql

    Make sure to included psa-php5-configurator s it is the configurator for Plesk

Leave a reply