PHP5 - Ubuntu 7.x

 

PHP5

 

+

Search Tips   |   Advanced Search

 

Overview

PHP scripts can be embedded into HTML.

This section explains how to install and configure PHP5 in Ubuntu System with Apache2 and MySQL.

This section assumes you have installed and configured Apache 2 Web Server and MySQL Database Server.

 

Installation

To install PHP5...

sudo apt-get install php5-common php5 libapache2-mod-php5

To run PHP5 scripts from the command line...

sudo apt-get install php5-cgi

To use MySQL with PHP5...

sudo apt-get install php5-mysql

To use PostgreSQL with PHP5...

sudo apt-get install php5-pgsql

 

Configuration

By default, the Apache 2 Web server is configured to run PHP5 scripts. Verify if the following files exist...

/etc/apache2/mods-enabled/php5.conf
/etc/apache2/mods-enabled/php5.load

If they do not exists, enable them using the a2enmod command.

Once PHP5 is installed and PHP5 Apache 2 module is enabled, restart the Apache2 Web server to run PHP5 scripts...

sudo /etc/init.d/apache2 restart

 

Testing

To verify your installation, you can run following PHP5 phpinfo script:

<?php print_r (phpinfo()); ?>

You can save the content in a file phpinfo.php and place it under DocumentRoot directory of Apache2 Web server. When point your browser to...

http://hostname/phpinfo.php

...it would display values of various PHP5 configuration parameters.

 

  Home