Install PHP 5.3 Mysql 5.5 Apache on Debian
Install PHP 5.3 Mysql 5.5 Apache on Debian
The other day I had a friend who just ordered a new bare VPS server and wanted to install phpmyadmin on it and run some php scripts and storing into a mysql database. He was running an OpenVZ Debian installation and I thought this just now that it would be a nice tutorial for other users trying to install PHP 5.3 Mysql 5.5 Apache on Debian. So here it is, I’ll go with a step by step with what you would need to use to install to get everything installed.
Installing Apache web server
On Debian it’s easy to install Apache directly from repository, you can manually compile it also if its really required but I really didn’t need to do it myself till now. So to install Apache run the below commands:
1 |
apt-get install apache2 |
By default you should have the repository for installing this. Once the web server is installed, you should be able to browse your server IP address and you should see it working.
Installing the Mysql server
In my next step it would the Mysql server 5.5, by default this should also be present on squeeze or wheeze, so you can just run the command:
1 |
apt-get install mysql-client-5.5 mysql-server-5.5 |
This would install the mysql server and it will ask you for the root password. Enter it twice please and you should be finished.
Installing php and php extensions on Debian / Ubuntu
This part contains more packages that need installed, for instance you need to install the mysql extension for the mysql server and also the mod_php5 module for apache web server. Of course other php extensions would need installed too.
However you will need to use a new repository / source list to install php 5.3, on debian I would recommend using Dotdeb. So you edit your source lists ( /etc/apt/sources.list ) and add there the line:
- for debian wheezy
1 2 |
deb http://packages.dotdeb.org wheezy all deb-src http://packages.dotdeb.org wheezy all |
- for debian squeeze
1 2 |
deb http://packages.dotdeb.org squeeze all deb-src http://packages.dotdeb.org squeeze all |
You will also need to fetch and install the GnuPG key:
1 2 |
wget http://www.dotdeb.org/dotdeb.gpg sudo apt-key add dotdeb.gpg |
After this you can run the update command to update the apt package list:
1 |
apt-get update |
Next you can start the php installation and get everything up and ready.
- Apache module mod_php5 installation
1 |
apt-get install php5 libapache2-mod-php5 |
- Install other php extensions including php5-mysql
1 |
apt-get install php5-mysql php5-curl php5-gd php5-idn php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-mhash php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl php5-json |
By now you should have a bunch of packages to be installed, this should get you with almost everything installed and you should be good to go.
Last step is to restart your web server for all extensions to load:
1 |
/etc/init.d/apache2 restart |
View phpinfo() page
To confirm everything is complete and working, you can create the a file info.php and add the content:
1 2 3 |
<?php phpinfo(); ?> |
You would then see a similar page when loading your serverIP/info.php
And that would be all folks, easy and simple, a web server running apache with php 5.3, mysql 5.5 would be up and running.
If you find any errors or anything you want to add, please let me know and comment below.