PHP Packages for Oracle Linux

Recent community releases of PHP built by Oracle

  • Home > 
  • PHP Packages for Oracle Linux

Table of Contents

About PHP for Oracle Linux

The PHP repositories contain the latest builds of stable PHP releases from the community, including the oci8 extension for the Oracle Database. They are provided without support.

Available PHP Releases

PHP Version Oracle Linux Release Repository Name
7.4 Oracle Linux 7 ol7_developer_php74
7.2 Oracle Linux 7 ol7_developer_php72
7.1 Oracle Linux 7 ol7_developer_php71
7.0 Oracle Linux 7 ol7_developer_php70
7.2 Oracle Linux 6 ol6_developer_php72
7.1 Oracle Linux 6 ol6_developer_php71
7.0 Oracle Linux 6 ol6_developer_php70

Installation

These are the steps to install PHP.

Set up Required Repositories

To configure the yum repositories shown above on your system, install the repository setup packagesoracle-php-release-el7 or oracle-php-release-el6 RPM. After installing this package, the default enabled repository is that for the latest available PHP release. To install the repository setup package for Oracle Linux 7:

$ sudo yum install -y oracle-php-release-el7


If yum is unable to find any of the packages mentioned below, follow the instructions on our Getting Started page to ensure your system is set up correctly to work with our release packages.



Installing PHP

Then, to install the latest available release of PHP on Oracle Linux 7:

$ sudo yum install -y php

Updating PHP

If you have PHP already installed, and a newer release has been published, make sure you update oracle-php-release-el7 first.

$ sudo yum update oracle-php-release-el7
$ sudo yum update php

Connecting PHP to Oracle Database with the PHP OCI8 Extension

The PHP OCI8 database extention enables access to Oracle Database with support for SQL, PL/SQL, bind variables, large object (LOB) types as well connection pooling and result caching features of Oracle Database. Read this blog post for a complete example connecting a PHP 7.4 application to Oracle Database.


Installing PHP OCI8

Each PHP release has its own repository on Oracle Linux yum server and each of those repositories also contains a corresponding RPM for the OCI8 extension, built for a specific major release of Oracle Instant Client. These RPMs follow this naming scheme: php-oci8<instant client release>. For example, on Oracle Linux 7, the PHP OCI8 RPM for PHP 7.4 is built with Instant Client 19c and is named: php-oci8-19c. To install it:

$ sudo yum install php-oci8-19c


About Oracle Instant Client

PHP OCI8 depends on Oracle Instant Client. Yum configurations for Oracle Instant Client are delivered via the oracle-release-el7 and oracle-release-el6 packages

Installing Oracle Instant Client

To install Oracle Instant Client on Oracle Linux 7:

$ sudo yum -y install oracle-release-el7
$ sudo yum -y install oracle-instantclient19.5-basic

As of Oracle Instant Client 19c, no additional configuration is needed for applications to use the Oracle client.

Installing PHP on Oracle Linux 8 via AppStream Modules

Oracle Linux 8 introduces the concept of Application Streams, where multiple versions of user-space components can be delivered and updated more frequently than the core operating system packages in RPM format or groups of related RPMs called Modules. Oracle Linux 8 offers several independently updated versions of PHP via Module Streams. For mode details, please refer to the documentation.

To list available Module Streams for PHP:

$ sudo dnf module list | grep php


To install PHP 7.3 :

$ sudo dnf install @php:7.3


Getting Help

For help with PHP on Oracle Linux, please visit the PHP space in the Oracle Developer Community.

software.hardware.complete