PHP Packages for Oracle Linux

  • Home > 
  • PHP Packages for Oracle Linux

Table of Contents

About PHP for Oracle Linux

This page describes PHP and related packages for current releases of Oracle Linux. For Oracle Linux 8, the packages are provided via AppStream modules and are covered under Oracle Linux support. Consult the Application Stream Module Life Cycle appendix in the Managing Software in Oracle Linux manual for support timelines. For Oracle Linux 7, these packages are published in developer repositories, for which support is limited to package installation assistance only.

Available PHP Releases

PHP Version Oracle Linux Release Repository/Module Name
7.4 Oracle Linux 7 ol7_developer_php74
7.4 Oracle Linux 8 php:7.4
7.3 Oracle Linux 8 php:7.3

Installation on Oracle Linux 7

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 packageoracle-php-release-el7. 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




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. Starting with Oracle Instant Client 21c, yum/dnf configuration files are delivered via the packages oracle-instantclient-release-el8 and oracle-instantclient-release-el7, respectively. Oracle Instant Client packages up to release 19c are in the ol7_oracle_instantclient and ol8_oracle_instantclient repositories, configured with release packages oracle-release-el7 and oracle-release-el8. Assuming you have enabled the repository for Oracle Instant Client appropriate for your Oracle Linux release, it will be installed as a dependency. More details about Oracle Instant Client on this yum server.

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:

$ dnf module list php


To install PHP 7.4 :

$ sudo dnf install @php:7.4


Installing PHP OCI8 on Oracle Linux 8

To install the PHP OCI8 on Oracle Linux 8, enable both the php:7.4 and the php-oci8 modules.


$ sudo dnf install oraclelinux-developer-release-el8 oracle-instantclient-release-el8
$ sudo dnf module enable php:7.4 php-oci8
$ sudo dnf install php-oci8-21c


PHP in Containers

On GitHub we provide resources to build your own container images or pull pre-built images, including:

  • PHP Command Line Interface tool (PHP CLI)
  • PHP via FastCGI Process Manager (FPM)
  • PHP via Apache HTTP Server with mod_php
  • Variants of each of the above with Oracle Database connectivity via PHP-OCI8

See the reference below to developer and run PHP applications in containers:

Getting Help

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

software.hardware.complete