Wednesday 13 August 2008

Installing PHP5 for Apache2 on Ubuntu 8.04

PHP5 - Scripting Language
PHP is a general-purpose scripting language suited for web development. The PHP script can be embedded into HTML. This section explains how to install and configure PHP5 in Ubuntu System with Apache2 and MySQL.

Installation
To install PHP5 you can enter the following command in the terminal prompt:
sudo apt-get install php5 libapache2-mod-php5

You can run PHP5 scripts from command line. To run PHP5 scripts from command line you should install php5-cli package. To install php5-cli you can enter the following command in the terminal prompt:
sudo apt-get install php5-cli

You can also execute PHP5 scripts without installing PHP5 Apache module. To accomplish this, you should install php5-cgi package. You can run the following command in a terminal prompt to install php5-cgi package:
sudo apt-get install php5-cgi

To use MySQL with PHP5 you should install php5-mysql package. To install php5-mysql you can enter the following command in the terminal prompt:
sudo apt-get install php5-mysql

To verify your installation, create a php file named info.php and write the following script into it.
print_r (phpinfo());
?>

If you need to have universe source list in your sources.list file
For php4 support
sudo apt-get install libapache2-mod-php4 php4-cli php4-common php4-cgi
For php5 support (as discussed earlier)
sudo apt-get install libapache2-mod-php5 php5-cli php5-common php5-cgi

Next open /etc/apache2/apache2.conf file and check the index files are correct
DirectoryIndex index.html index.cgi index.pl index.php index.xhtml
If you want to enable some Apache modules (SSL, rewrite, suexec, and include)
sudo a2enmod ssl
sudo a2enmod rewrite
sudo a2enmod suexec
sudo a2enmod include
Restart Apache to make sure all is well.
sudo /etc/init.d/apache2 restart





2 comments:

Anonymous said...

Merry Christmas! Let the new year will bring a lot of money

Anonymous said...


Understanding to the the basis of a problem begins with figuring out the the premise.