-
Book Overview & Buying
-
Table Of Contents
PHP Oracle Web Development: Data processing, Security, Caching, XML, Web Services, and Ajax
By :
The current recommended releases of PHP are available for download from the downloads page of the php.net site at:
http://www.php.net/downloads.php
From this page, you can download the latest stable release of PHP 5 and then follow the steps below to install PHP in your system. For further assistance along the way, you may consult the Installation and Configuration manual available on the php.net web site at: http://www.php.net/manual/install.php. Alternatively, you might read the install.txt file that is shipped with PHP.
Here are the basic installation steps for PHP 5 on Windows:
Extract the distribution file into the c:\php directory.
Add the C:\php directory to the PATH to make php5ts.dll available to the web server modules.
Rename php.ini-recommended to php.ini.
In php.ini, set the doc_root to your htdocs directory of Apache. For example:
doc_root = c:\Program Files\Apache Group\Apache2\htdocs
In the Apache httpd.conf configuration file, to install PHP as an Apache module, insert the following two lines:
LoadModule php5_module "c:/php/php5apache2.dll" AddType application/x-httpd-php .php
In the Apache httpd.conf configuration file, configure the path to php.ini:
PHPIniDir "C:/php"
Restart Apache.
As an alternative to the above manual installation, you might use the Windows PHP installer that is also available from the downloads page of the php.net website.
Although the Windows PHP installer is the fastest way to make PHP work, it doesn't allow you to set every option as you might want to. So, using the installer isn't the recommended method for installing PHP.
Once you have PHP installed on your Windows system, you might want to set some extensions for added functionality. It is important to note that many extensions are built into the Windows version of PHP. To use these extensions, you just uncomment them in the php.ini configuration file—no additional DLLs are required. However, some of the extensions require extra DLLs to work. For example, the PHP OCI8 extension needs the Oracle Client libraries.
Here are basic installation steps for PHP 5 on Unix-like systems:
Extract the distribution file:
# gunzip php-5xx.tar.gz # tar -xvf php-5xx.tar
Change dir to the directory containing the PHP sources:
# cd php-5xx
Configure your PHP installation:
# ./configure --with-apxs2=/usr/local/apache2/bin/apxs
You cannot configure PHP to support the PHP OCI8 extension until you install the Oracle Client libraries required to run OCI applications (unless you have PHP and Oracle installed on the same computer). You'll need to recompile PHP for OCI8 support once you have these libraries installed. See the Oracle Instant Client section for details.
Compile and then install PHP:
# make # make install
Set up php.ini.
# cp php.ini-dist /usr/local/lib/php.ini
Edit the httpd.conf Apache configuration file to load the PHP module into Apache:
LoadModule php5_module modules/libphp5.so
In httpd.conf, add handlers for files with the .php and .phps extensions:
AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps
Restart Apache:
# usr/local/apache2/bin/apachectl start
By now you should have a working Apache/PHP web server.
Once you have finished the installation steps, you might want to test PHP. The easiest way to make sure that PHP works properly is by using the following simple PHP script:
<?php phpinfo(); ?>
Save this script as phptest.php in the htdocs directory of Apache and then run it in your browser by opening the following URL:
http://yourservername/phptest.php
Provided your Apache/PHP web server is up and running, the phptest.php script should output a large amount of information about the current state of PHP. Graphically it might look like the following figure.

As expected, the phpinfo output doesn't contain an OCI8 section—we have installed PHP without OCI8 support. The next section discusses how to add the OCI8 support to an existing installation of PHP.
Change the font size
Change margin width
Change background colour