PHP installation and configuration

Use this procedure to set up PHP for use with the Management Console.

Before you begin

Requirements:

About this task

Follow the instructions in this section to configure PHP for the Apache HTTP Server or other web server. The instructions assume that you have already downloaded the required version of the PHP.

Install PHP

About this task

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 Instant Client: oci8 driver
Note: Currently, the full Oracle client is not compatible with PHP oci8. Use Oracle Instant Client only.

Procedure

  1. Configure PHP for installation in the working directory you just created.
    $ ./configure --prefix=/usr/local/php-5.2.4 --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.
    • Microsoft SQL Server: --with-mssql[=dir]
    • Oracle: You must install a separate installation of Oracle Instant Client to use PHP oci8. When 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.4. 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

Procedure

  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.4. Note that <datestamp> is a string of numbers.
    $ cd /usr/local/php-5.2.4/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.4:
    $ cd /usr/local/php-5.2.4/lib/
    $ vi php.ini
    Add the following entries:
    extension_dir=/usr/local/php-5.2.4/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

Procedure

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

About this task

Optional: this step is needed only if the Management Console needs to use a proxy server to access its database.

Procedure

Edit the PHP configuration file php.ini. It is located in <php-install>/lib, for example /usr/local/php-5.2.4.

Add the following entries:

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

Feedback