Friday, November 04, 2011

Installing Apache2 With PHP5 And MySQL Support On Debian Squeeze

Installing MySql
aptitude install mysql-server mysql-client
Installing Apache2, Apache2 is available as a Debian package, therefore we can install it like this
aptitude install mysql-server mysql-client
Now direct your browser to htto://localhost, and you should see the apache2 placehoder page(it works!)
Spoiler for title :
We can install PHP5 ang the apache PHP 5 module as follows
aptitude install php5 libapache2-mod-php5
We must restart apache afterwards
/etc/init.d/apache2 restart
The document root of the default web site is /var/www. We will now create a small PHP file(info.php) in that directory and call it in browser. The file will display lots of useful details about our PHP installation, such as the installed PHP version.
vi /var/www/info.php
<?php
phpinfo();
?>
Now  we call that file in a browser(http://localhost/info.php)
Spoiler for title :
To get MySql support in PHP, we can install the php5-mysql package. It's a good idea to install some other PHP5 modules as well as you might need them for your applications. You can search for avaulabe PHP5 modules like this
aptitude search php5
Pick the ones you need ang install them like this
aptitude 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
Now restart apache2
/etc/init.d/apache2 restart
Now reload http://localhost/info.php in your browser ang scroll down to the modules section again. You should now find lots of new modules there, including the MySql module
Spoiler for title :
Phpmyadmin is a web interface through which you can manage your MySql database. It's a good idea to install it
aptitude install phpmyadmin
Afterwards, you can acsess phpmyadmin under http://localhost/phpmyadmin

Spoiler for title :

0 comments:

Post a Comment