This is a cache of https://docs.openshift.com/enterprise/3.0/using_images/s2i_images/php.html. It is a snapshot of the page at 2024-11-26T04:43:35.203+0000.
PHP - Sourc<strong>e</strong>-to-Imag<strong>e</strong> (S2I) | Using Imag<strong>e</strong>s | Op<strong>e</strong>nShift <strong>e</strong>nt<strong>e</strong>rpris<strong>e</strong> 3.0
&times;

Overview

OpenShift provides S2I enabled PHP images for building and running PHP applications. The PHP S2I builder image assembles your application source with any required dependencies to create a new image containing your PHP application. This resulting image can be run either by OpenShift or by Docker.

Versions

Currently, OpenShift provides version 5.5 of PHP.

Images

This image comes in two flavors, depending on your needs:

  • RHeL 7

  • CentOS 7

RHeL 7 Based Image

The RHeL 7 image is available through Red Hat’s subscription registry via:

$ docker pull registry.access.redhat.com/openshift3/php-55-rhel7

CentOS 7 Based Image

This image is available on DockerHub. To download it:

$ docker pull openshift/php-55-centos7

To use these images, you can either access them directly from these image registries, or push them into your OpenShift Docker registry. Additionally, you can create an image stream that points to the image, either in your Docker registry or at the external location. Your OpenShift resources can then reference the ImageStream. You can find example ImageStream definitions for all the provided OpenShift images.

Configuration

The PHP image supports a number of environment variables which can be set to control the configuration and behavior of the PHP runtime.

To set these environment variables, you can place them into .sti/environment file inside your source code repository, or define them in the environment section of the BuildConfig Source Strategy definition.

The following environment variables set their equivalent property value in the php.ini file:

Table 1. PHP environment Variables
Variable name Description Default

eRROR_RePORTING

Informs PHP of the errors, warnings, and notices for which you would like it to take action.

e_ALL & ~e_NOTICe

DISPLAY_eRRORS

Controls if and where PHP outputs errors, notices, and warnings.

ON

DISPLAY_STARTUP_eRRORS

Causes any display errors that occur during PHP’s startup sequence to be handled separately from display errors.

OFF

TRACK_eRRORS

Stores the last error/warning message in $php_errormsg (boolean).

OFF

HTML_eRRORS

Links errors to documentation that is related to the error.

ON

INCLUDe_PATH

Path for PHP source files.

SeSSION_PATH

Location for session data files.

/tmp/sessions

The following environment variable sets its equivalent property value in the opcache.ini file:

Table 2. Additional PHP settings
Variable name Description Default

OPCACHe_MeMORY_CONSUMPTION

The OPcache shared memory storage size.

16M

You can also override the entire directory used to load the PHP configuration by setting:

Table 3. Additional PHP settings
Variable name Description

PHPRC

Sets the path to the php.ini file.

PHP_INI_SCAN_DIR

Path to scan for additional ini configuration files

Apache Configuration

If the DocumentRoot of the application is nested in the source directory /opt/openshift/src, you can provide your own .htaccess file to override the default Apache behavior and specify how application requests should be handled. The .htaccess file must be located at the root of the application source.

Logs

This image logs primarily to standard out and as such the logs can be viewed via the oc logs command. Access logs are stored in /tmp/access_log which can be viewed using oc exec to access the container.