In this post , I will be posting the steps that you can follow to install Apache2 with PHP5 and MySQL Support On Debian Lenny.
This tutorial assumes that user has root level access to the server
we begin the installation process by updating
apt-get update && apt-get upgrade

Next we will install MySQL
apt-get install mysql-server mysql-client
during installation you will be asked to set a password for root user..
I recommend to use a strong password .
Next we will install Apache2
apt-get install apache2
After we install Apache2 , we can use the following commands
Start
/etc/init.d/apache2 start
Stop
/etc/init.d/apache2 stop
Restart
/etc/init.d/apache2 restart
Apache’s default document root is /var/www/ in Debian and Apache’s configuration file is etc/apache2/apache2.conf . In future posts , I will be dealing with Configuring Apache2.
Next we will install PHP5
apt-get install php5 libapache2-mod-php5
Now in order to get PHP support on Apache2, we have to restart Apache2..
/etc/init.d/apache2 restart
To test for PHP support on Apache, we will create a info file which will show lots of information about the server on which it’s installed.
Using your favourite text editor create a new file and name it as info.php with the following contents .
<?php phpinfo(); ?>
Now we will call the file from a browser .Assuming that the I.Padress of the server is 192.168.1.2
we can call it by typing http://192.168.0.100/info.php in the browser.
If you are able to see a page with some info on your system , then you have installed Apache2 with PHP5 successfully..and it looks something like this

Now in order to get MySQL support , we have to install php5-mysql package.
apt-get install php5-mysql
and We have to restart Apache2 get MySQL support
/etc/init.d/apache2 restart
Now if we see the PHPinfo , we should be able to see MySQL support in it..
we can install many php packages. (Optional and your choice )
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
select the packages that you need and you can install them by
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
.Please note that you have to restart Apache2 to get the new modules working.
Optionally we can install PHPMyadmin , as its very handy to manage databases.
apt-get install phpmyadmin
and while installation, select APache2 when it asks “Web server to reconfigure automatically”
you should be able to open phpmyadmin by entering
http://yourIP/phpmyadmin/ from the browser..
if it don’t work then use the below command
echo "Include /etc/phpmyadmin/apache.conf" >> /etc/apache2/apache2.conf
{ 1 trackback }
{ 1 comment… read it below or add one }
wow..thanks ! and demo is working !!!