Verification: a143cc29221c9be0

Oracle linux php 7 install

Table of Contents

  • About PHP for Oracle Linux
  • Available PHP Releases
  • Installation
  • Set up Required Repositories
  • Installing PHP
  • Updating PHP
  • Connecting PHP to Oracle Database with the php-oci8 Extension
  • About Oracle Instant Client
  • Installing php-oci8
  • Installing PHP on Oracle Linux 8 via AppStream Modules
  • PHP in Containers
  • Getting Help

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

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 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. 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:

$ dnf module list php

To install PHP 7.4 :

$ sudo dnf install @php:7.4

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:

  • Example Dockerfiles for PHP: Oracle Linux 8, Oracle Linux 7
  • PHP container images on GitHub Container registry: Oracle Linux 8, Oracle Linux 7

Prerequisites

WARNING: If you already have a Web Server with Apache and PHP 7.3 configured, just go to the IonCube configuration and proceed to manual installation.

To proceed with the installation, you will need to download some files.

Necessaries Files:

  • IonCube Loader for Linux (x86 ou x64): Click Here
  • Scriptcase (.zip): Click Here

NOTE: Before continue with the installation is recommended that you do not have any other web environment (as XAMP, Zend Server, etc) installed in your operational system. It is recommended to know Linux/Unix environment to use the terminal.

Configuring the PHP - Ubuntu 19.10\Debian 10

Listed below are the necessaries commands for the manual installation of the PHP 7.3 in the Ubuntu 19.10 or Debian 10. Check correctly the name of the packages in your terminal.

1 - Before run any other command, update your operating system with the following commands:

sudo apt-get update
sudo apt-get upgrade

2 - Run the command sudo apt-get install php7.3 to install the PHP 7.3. After that, accept the dependencies installation.

If you are using any Ubuntu version before 19.10, it’s necessary to add a repository in your operating system to access the PHP 7.3 packages. See how you can do it below:

sudo add-apt-repository ppa:ondrej/php
sudo apt-get update

If you are using any Debian version before Debian 10, it’s necessary to add a repository in your operating system to access the PHP 7.3 packages. See how you can do it below:

sudo apt -y install lsb-release apt-transport-https ca-certificates

sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php7.3.list

sudo apt-get update

sudo apt-get install php7.3

Example:

3 - Check the PHP version running the command: php -v

Example:

PHP Version

4 - Now, install all the extensions below that are required by Scriptcase:

Default Extensions:

  • sudo apt-get install php7.3-curl
  • sudo apt-get install php7.3-gd
  • sudo apt-get install php7.3-bcmath
  • sudo apt-get install php7.3-cgi
  • sudo apt-get install php7.3-ldap
  • sudo apt-get install php7.3-mbstring
  • sudo apt-get install php7.3-xml
  • sudo apt-get install php7.3-soap
  • sudo apt-get install php7.3-xsl
  • sudo apt-get install php7.3-zip

Database Extensions:

Extension Driver enabled in Scriptcase
sudo apt-get install php7.3-pgsql PostgreSQL PDO, PostgreSQL 6.3 or below, PostgreSQL 6.4 or above, PostgreSQL 7 or above
sudo apt-get install php7.3-mysql MySQLi, MySQL PDO
sudo apt-get install php7.3-sqlite3 SQLite PDO
sudo apt-get install php7.3-interbase Firebird, Interbase 6, Interbase 6.5, Firebird PDO
sudo apt-get install php7.3-odbc DB2 ODBC GENERIC, DB2 ODBC GENERIC 6, Generic ODBC, MS Access ODBC, Oracle ODBC, Progress, DB2 PDO ODBC, Progress PDO ODBC, Sybase PDO ODBC
sudo apt-get install php7.3-sybase DBLIB, Sybase PDO DBLIB

NOTE: Some database extensions will depend on third party drivers to be enabled. Click here to access the setup instructions for your database.

5 - Access the php.ini file in the directory /etc/php/7.3/apache2/ and set the recommended values for the PHP directives listed below required by the Scriptcase.

Search for theses directives and set the values as the example:

  • max_execution_time = 3600
  • max_input_time = 3600
  • max_input_vars = 10000
  • memory_limit = 1024M
  • post_max_size = 1024M
  • upload_max_filesize = 1024M
  • max_file_uploads = 200
  • short_open_tag = On

6 - By default, the PHP disable some functions that are required by the Scriptcase. Click here to access the list of these functions.

  • Change the line disable_functions as the example below:

disable_functions =

Example:

Configuring the disable_functions

7 - Set up the PHP TimeZone according your region. Must use the values available in the PHP documentation. Search for the line date.timezone in your php.ini, uncomment and edit according with the TimeZone selected.

Example:

date.timezone = America/Recife

8 - Set up the folders that will store the temporary files. Search for the line ;session.save_path, uncomment and set the path to your temporary folder.

Example:

session.save_path = "/tmp"

9 - Save all the changes made and restart the Apache service using the following command:

sudo service apache2 restart

10 - Check if the changes were made using the file info.php. You will need to create this file and place it in the /var/www/html/ path with the following content.

phpinfo();

?>

After that, check using your browser the page generated accessing the URL 127.0.0.1/info.php.

Check PHP

NOTE: For more information about the phpinfo(), check the PHP documentation.

Setting up the PHP - CentOS 8

Listed below are the necessaries commands for the manual installation of the PHP 7.3 in the CentOS 8. Check correctly the name of the packages in your terminal.

1 - Before run any other command, update your operating system with the following commands:

sudo yum update
sudo yum upgrade

NOTE: In the default CentOS 7/8 repository, the PHP 7.3 is not installed by default. It will need to add the repository to continue the installation.

2 - Add the repository below to download the PHP 7.3 packages and after that update your system:

sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
sudo dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm
sudo yum update

If you use any CentOS version below the 8, it’s necessary to add another repository in your operating system to access the PHP 7.3 packages. See how to do it below:

CentOS 6 CentOS 7
sudo yum install epel-release sudo yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
sudo rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm sudo yum -y install epel-release yum-utils
  • In the CentOS 6, it is needed to enable the PHP 7.3 module using the command below:

sudo yum --enablerepo=remi-php73 install php

3 - Run the commands below to install the PHP 7.3 and Apache 2.4 modules and accept their dependencies:

sudo dnf module install php:remi-7.3
sudo yum install httpd

Example:

Installing the PHP

4 - Check the PHP version running the command: php -v

Example:

PHP version

5 - Now, install the extensions below required by the Scriptcase:

  • To search for packages in versions below CentOS8, you will need to use the command: yum search php73

Default Extensions:

  • sudo yum install php-bcmath
  • sudo yum install php-common
  • sudo yum install php-cli
  • sudo yum install php-gd
  • sudo yum install php-json
  • sudo yum install php-ldap
  • sudo yum install php-mbstring
  • sudo yum install php-soap
  • sudo yum install php-xml
  • sudo yum install php-zip

Database Extensions:

Extension Driver enabled in the Scriptcase
sudo yum install php-pgsql PostgreSQL PDO, PostgreSQL 6.3 or below, PostgreSQL 6.4 or above, PostgreSQL 7 or above
sudo yum install php-mysql MySQLi, MySQL PDO
sudo yum install php-sqlite3 SQLite PDO
sudo yum install php-odbc DB2 ODBC GENERIC, DB2 ODBC GENERIC 6, Generic ODBC, MS Access ODBC, Oracle ODBC, Progress, DB2 PDO ODBC, Progress PDO ODBC, Sybase PDO ODBC
sudo yum install php-pdo-dblib DBLIB, Sybase PDO DBLIB

NOTE: Some database extensions will depend on third party drivers to be enabled. Click here to access the setup instructions for your database.

6 - Access the php.ini file in the directory /etc/ and set the recommended values for the PHP directives listed below required by the Scriptcase.

Search for theses directives and set the values as the example:

  • max_execution_time = 3600
  • max_input_time = 3600
  • max_input_vars = 10000
  • memory_limit = 1024M
  • post_max_size = 1024M
  • upload_max_filesize = 1024M
  • max_file_uploads = 200
  • short_open_tag = On

7 - By default, the PHP disable some functions that are required by the Scriptcase. Click here to access the list of these functions.

  • Change the line disable_functions as the example below:

disable_functions =

Example:

Configuring the disable_functions

8 - Set up the PHP TimeZone according your region. Must use the values available in the PHP documentation. Search for the line date.timezone in your php.ini, uncomment and edit according with the TimeZone selected.

Example:

date.timezone = America/Recife

8 - Set up the folders that will store the temporary files. Search for the line ;session.save_path, uncomment and set the path to your temporary folder.

Example:

session.save_path = "/tmp"

9 - Save all the changes made and restart the Apache service using the following command:

sudo systemctl restart httpd

10 - Check if the changes were made using the file info.php. You will need to create this file and place it in the /var/www/html/ path with the following content.

phpinfo();

?>

After that, check using your browser the page generated accessing the URL 127.0.0.1/info.php.

Check PHP

NOTE: For more information about the phpinfo(), check the PHP documentation.

Enabling the IonCube Loader

Before starting the Scriptcase installation, you need to enable the loader used for the Scriptcase encryption in your PHP. Follow the steps below showing how to dot it.

1 - Access the Downloads folder and extract the file downloaded referent to the IonCube Loader at the beggining of this documentation.

Example:

cd /home/User/Downloads

sudo chmod 777 ioncube_loaders_lin_x86-64.zip && unzip ioncube_loaders_lin_x86-64.zip

2 - Copy the file ioncube_loader_lin_7.3.so and past in the extension_dir directory of your PHP. We will use the path /usr/lib/php/20180731 for this example.

Example:

Ubuntu 19.10\Debian 8 CentOS 7/8
/usr/lib/php/20180731 /usr/lib64/php/modules

sudo cp ioncube_loader_lin_7.3.so /usr/lib/php/20180731

3 - Edit the php.ini file and below the last line set the path to the extension in the zend_extension parameter:

Example:

Ubuntu 19.10\Debian 8 CentOS 7/8
/etc/php/7.3/apache2/ /etc/

sudo nano /etc/php/7.3/apache2/php.ini

zend_extension = "/usr/lib/php/20180731/ioncube_loader_lin_7.3.so"

4 - Restart the Apache service using the following command:

Ubuntu 19.10\Debian 8 CentOS 7/8
sudo service apache2 restart sudo systemctl restart httpd

IMPORTANT: To enable the IonCube in the CentOS, the SELinux service must be disabled. Check the service status using the command: sestatus.
To disabled the service, access the file settings using the command sudo nano /etc/selinux/config and change the SELINUX and SELINUXTYPE directives as this: SELINUX=disabled e SELINUXTYPE=minimum. After that, save the file and restart your Centos to apply the changes and enable the IonCube.

Scriptcase Manual Installation

Listed below are the steps needed to do a Scriptcase manual installation. To do the steps, it is needed that you have a web server configured in your machine.

1 - Download the Scriptcase (.zip) directly from the download page from our website.

2 - Extract the .zip file and rename the extracted folder to scriptcase.

3 - Move the scriptcase to your server root. Depending of your operating system and the installation the path can be different from the example. However, by default the paths are:

Windows Server
C:\Apache24\htdocs\ Apache
C:\inetpub\wwwroot\ IIS
Linux Server
/var/www/html/ Linux Local
/home/$(whoami)/public_html/ Linux Server
macOS Server
/Library/WebServer/Documents Apache

4 - Access the Scriptcase using your browser:

127.0.0.1/scriptcase

  • By default the selected language is English.

Setup Screen

5 - Check the extensions required for Scriptcase to function and database connection modules that are enabled.

Screen with list of active extensions

Typical Installation

Check the steps below to complete the manual installation of Scriptcase in a typical way.

NOTE: By selecting this installation, Scriptcase will set your environment by default. Defining the installation database and the login user in Scriptcase.

Installation Type Selection Screen

After clicking proceed, you will be redirected to the Scriptcase Login page.

Scriptcase access screen

User

In this field, it is necessary to inform the user to login to Scriptcase. By default, the user is admin.

Password

In this field, you must enter the password to login to Scriptcase. By default, the password is admin.

Keep me connected

This option keeps the user logged in until they log out through the Scriptcase interface.

Forgot your password?

By clicking this option, it is possible to recover the password of the informed user. An email will be sent to the user in question so they can access the recovery steps.

Important: You can only perform password recovery if you have configured your SMTP information. To access our documentation showing how to perform this configuration click here.

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 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:

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

    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-12.1.0.1.0-1.x86_64.rpm
  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
    export NLS_LANG=AMERICAN_AMERICA.WE8MSWIN1252
    

    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.