BuildForge Help

PHP Installation and Configuration

Use this procedure to download, install, and configure PHP for use with the Management Console on UNIX and Linux.

This section includes instructions for you to perform the following steps:

Download PHP

To obtain PHP source code:

  1. Download the PHP source code to the intended Build Forge host. Do the following as a non-root user.
    1. Make a temporary working directory.
    2. Go to http://php.net/downloads.php/
    3. Download the gzipped version under Complete Source Code (file extension .gz)
      For example, at this writing the file name is as follows:
      php-5.2.1.tar.gz
      
  2. Extract the image.
    $ gunzip -c php-5.2.1.tar.gz | tar xvf -
    
    Note that tar is set to use stdin for the pipe (using the - parameter)
  3. Go to the newly created working directory.
    $ cd php-5.2.1

Install PHP

This section describes how to compile and install PHP from source. If you have an existing installation of PHP and do not wish to recompile, you need only determine if the appropriate database drivers are installed. If you need to install a database driver, consult PHP documentation for the installation method to use. Install the database driver for the database to use with Build Forge, as follows:
  • DB2: ibm_db2 driver
  • MySQL: mysqli driver
  • Oracle: oci8 driver
  1. Configure PHP for installation in the working directory you just created.
    $ ./configure --prefix=/usr/local/php-5.2.1 --with-<database>=shared \
    --with-apxs2 --with-ldap=shared --enable-mbstring --enable-shmop \
    --with-xml --with-zlib=shared
    
    Replace --with-<database> as follows:
    • DB2: --with-ibm_db2[=dir]. If =dir is not specified, the default value is used:/home/db2inst1/sqllib
    • MySQL: --with-mysqli[=file]. The optional file parameter is a pathname to mysql_config.
    • Oracle: --with-oci8[=dir] If =dir is not specified, the default value is used:ORACLE_HOME. If you are using Oracle Instant Client to connect to the database, use --with-oci8=instantclient,lib where lib is the path to the Instant Client lib directory.

    Note the line-continuation character \ in the code block. This step specifies where PHP will be installed and what options it will be installed with. It is installed in /usr/local by default. The example shows how to put it in /usr/local/php-5.2.1. This location is used in later examples.

  2. Compile PHP.
    $ make
    

    This step compiles executables in your local directory.

  3. Install PHP (do as root).
    # make install
    
    This step must be performed as a user who has write privileges for the directory where Apache is installed (/usr/local/apache-2.2.4 in this example). It is normally done as root. Your local administrative setup may vary.

Configure PHP

  1. Copy extension files to the extension directory. The extension files for the database need to be copied from the repository up to the active extensions directory. The following example assumes that PHP is installed in /usr/local/php-5.2.1. Note that <datestamp> is a string of numbers.
    $ cd /usr/local/php-5.2.1/lib/php/extensions/no-debug-non-zts-<datestamp>/
    $ cp <db-extensions> ..
    
    The <db-extensions> files correspond to your database for Build Forge, as follows:
    • DB2: ibm_db2.so
    • MySQL: mysql.so and mysqli.so
    • Oracle: oci8.so
  2. Edit the PHP configuration file php.ini. The following example assumes that PHP is installed in /usr/local/php-5.2.1:
    $ cd /usr/local/php-5.2.1/lib/
    $ vi php.ini
    
    Add the following entries:
    extension_dir=/usr/local/php-5.2.1/lib/php/extensions
    upload_tmp_dir=<directory>
    extension=<db-extension-so>
    
    
    Use the <db-extensions-so> file name (or file names) for your database, as follows:
    • DB2: extension=ibm_db2.so
    • MySQL: two entries -
      extension=mysql.so
      extension=mysqli.so
    • Oracle: extension=oci8.so
    Note: the directory used for upload_tmp_dir must be writable by the user that the Apache web server runs as. Commonly this user is nobody, but your local administrative practice may vary.

Edit Apache Configuration File

Edit Apache configuration file. Add information about PHP in httpd.conf.
cd <apache-dir>
vi httpd.conf
Add the following lines:
LoadModule php5_module modules/libphp5.so
AddHandler php5-script .php
AddType text/html .php
DirectoryIndex index.php

Identify Proxy Server

Optional: this step is needed only if the Management Console needs to use a proxy server to access its database.
Edit the PHP configuration file php.ini. It is located in <php-install>/lib, for example /usr/local/php-5.2.1.

Add the following entries:

bf_proxyHost=<your_proxy_server_hostname>
bf_proxyPath=<your_proxy_path>
bf_symlinkPath=<symlink_to_proxy_path>