PHP RPM Package Installation

The PHP packages were built for Oracle Linux 6 on x86_64. They will also install on Red Hat Enterprise Linux.

On Oracle Linux, PHP's DTrace Dynamic Tracing features can be used.

The packages are provided for installation convenience and are not supported. If support is needed, use Zend Server.

Installing PHP 5.5 for Command-line and Apache Use

To install PHP for CLI use, and for use as an Apache mod:

  1. Log into a command shell as the root user.

  2. Deinstall any existing PHP packages. Use rpm -qa | grep php to show the php packages currently installed. Use rpm -e <package_name> to remove them, for example rpm -e php-common

  3. Download the php55-* RPMs from this project.

  4. Install the RPMs with:

    rpm -ivh php55-common-5.5.10-1.el6.x86_64.rpm php55-cli-5.5.10-1.el6.x86_64.rpm php55-5.5.10-1.el6.x86_64.rpm

    If any dependencies are unsatisfied, install the required packages from a repository of your choice and retry the above command.

  5. To verify the PHP RPMs have been installed, run rpm -qa | grep php. You should see:


    Other php55-* packages can be installed to add various standard PHP extensions.

  6. Restart Apache:

    /sbin/service httpd restart

The PHP configuration file is located at /etc/php.ini. Edit it and set a default value for date.timezone.

A directory /etc/php.d will contain configuration files of any extra PHP extensions installed.

The Apache configuration file for PHP is in /etc/httpd/conf.d/php.conf.

This set of steps also installs the php-cgi program which can optionally be used with FastCGI. The newer php-fpm module is available in the php55-fpm RPM.

Installing the OCI8 Extension for Oracle Database

The php55-oci8-12cR1 package installs the OCI8 extension for Oracle Instant Client 12.1.

To install the OCI8 extension:

  1. Download the Oracle Instant Client "basic" package and install it with:

    rpm -ivh oracle-instantclient12.1-basic-
  2. Install PHP's Oracle OCI8 extension with:

    rpm -ivh php55-oci8-12cR1-5.5.10-1.el6.x86_64.rpm
  3. When using mod_php with Apache on Oracle Linux, you can add environment variables needed by the OCI8 extension to the end of /etc/sysconfig/httpd, for example:

    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/oracle/12.1/client64/lib

    Adjust the language, territory and character set to suit your globalization requirements.

    If you use Oracle Net configuation files such as tnsnames.ora make sure the files are readable by the webserver and set TNS_ADMIN to their parent directory:

    export TNS_ADMIN=/opt/local/tnsconfigdir

    Since OCI8 uses Oracle Instant Client, do not set ORACLE_HOME.

  4. Optionally edit /etc/php.d/oci8.ini and configure OCI8 settings.

  5. Restart Apache:

    /sbin/service httpd restart
  6. Verify that OCI8 is installed by saving this script in your document root, e.g. /var/www/html/pi.php, and loading http://localhost/pi.php in a browser:


    If installation was successful, the output will include a section on OCI8 showing build and configuration options.

Using the OCI8 Extension

The Oracle Technology Network has a PHP Developer Center with many resources, in particular refer to the free Underground PHP and Oracle Manual. This book contains best practices information on using PHP and Oracle effectively and efficiently, with lots of examples and sample code.

Installing the MySQL Extensions for the MySQL Database

The php55-mysql-5.5.10-1.el6.x86_64.rpm package provides the PHP mysql, mysqli and pdo_mysql extensions. They use the PHP MySQL "Native Driver" which gives direct access to a MySQL database without needing MySQL's Client Libraries.

To install these extensions:

  1. Download the php55-mysql-* and php55-pdo-* RPMs from this project.

  2. Install the RPMs with:

    rpm -ivh php55-mysql-5.5.10-1.el6.x86_64.rpm php55-pdo-5.5.10-1.el6.x86_64.rpm
  3. Optionally edit /etc/php.d/mysql.ini, /etc/php.d/mysqli.ini, /etc/php.d/pdo_mysql.ini or /etc/php.d/mysqlnd.ini and configure settings as required.

  4. Restart Apache:

    /sbin/service httpd restart
  5. Verify that the extensions are installed by saving this script in your document root, e.g. /var/www/html/pi.php, and loading http://localhost/pi.php in a browser:


    If installation was successful, the output will include sections on the MySQL extensions.

Back to PHP RPM project home page