Document toolboxDocument toolbox

PHP 7.2 Upgrade

IMPORTANT: These instructions are only for upgrade installations only. If you are installing a new server, or do not want to run PHP 7.2 alongside an older version please see the PHP 7.2 Install Instructions

Additionally, REDHAT 8 does not auto configure php-fpm as it does in previous versions, so for REDHAT 8, these instructions should be used:

Note to Licensed Customers:

The following information represents the process we use to upgrade hosted installations. 

  • The repos may vary depending the installation.
  • Licensed customers are welcome to use any repos they deem appropriate.
  • All modules listed under "Install the PHP modules required by PCR-360 " are required for PCR-360 to function correctly.
  • The only optional modules are the installation-specific modules listed below the required ones.
  • Zend Guard Loader is not supported in PHP 7.2, is not included in the required modules, and may be safely removed.
  • MCrypt has been deprecated in PHP 7.2, but is still available as an addon module.
  • In PCR-360 version 2019.1, we will be removing the usage of MCrypt in favor of OpenSSL encryption. For version 2018.1, MCrypt is still a required module.

Required PHP Modules

NameDescription
php72-php-processDynamic shared objects which add support to PHP using system interfaces for inter-process communication.
php72-php-xml Dynamic shared objects which add support to PHP for manipulating XML documents using the DOM tree, and performing XSL transformations on XML documents.
php72-php-pecl-apcuAPC Caching Support
php72-php-gd Dynamic shared object that will add support for using the gd graphics library to PHP.
php72-php-intl Dynamic shared object that will add support for using the ICU library to PHP.
php72-php-mbstringDynamic shared object that will add support for multi-byte string handling to PHP
php72-php-pecl-mcrypt Deprecated, but still currently required. Support for the mcrypt encryption API.
php72-php-pdoDynamic shared object that will add a database access abstraction layer to PHP. This module provides a common interface for accessing MySQL, PostgreSQL or other databases.
php72-php-soap

Dynamic shared object that will add support to PHP for using the SOAP web services protocol.

php72-php-pecl-zipLibrary for processing zip files

Optional PHP Modules

NameDescription
php72-php-mysqlnd
MySQL Support
php72-php-oci8
Oracle Support
php72-php-ldap
LDAP Support

Required Packages

NameDescription
php72The PHP 7.2 Package
php72-php-fpmPHP 7.2 FPM Service
mod_proxy_fcgiApache Proxy Mod

Upgrade Process

  1. Update all packages 

    yum update
    1. In some cases you may see this error: 

      The GPG keys listed for the "Percona-Release YUM repository - noarch" repository are already installed but they are not correct for this package.
      Check that the correct key URLs are configured for this repository.
    2. To resolve, manually edit the repo file:

      vim /etc/yum.repos.d/percona-release.repo
      # change all instances of 
      gpgcheck = 1
      # to
      gpgcheck = 0
      # save and close the file, then try to update again
  2. Reboot the server: 

    reboot now
  3. Make sure the EPEL repo is installed and active
    1. The following file should exist: 

      /etc/yum.repos.d/epel.repo
    2. and contain the section [epel] with the value enabled=1

    3. If not, install the repo 

      ## RHEL/CentOS 6 64-Bit ##
      # wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
      # rpm -ivh epel-release-6-8.noarch.rpm
      
      
      ## RHEL/CentOS 7 64-Bit ##
      # wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
      # rpm -ivh epel-release-latest-7.noarch.rpm



  4. Install the remi-safe repo: 

    # Redhat 6 or CentOS 6
    yum -y install http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
    
    # Redhat 7 or CentOS 7
    yum -y install http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
  5. Install PHP 7.2, FPM for PHP 7.2, and the Apache FPM Mod 

    yum -y install php72 php72-php-fpm mod_proxy_fcgi
  6. Edit the php.ini file. This will typically be located at /etc/opt/remi/php72/php.ini. The following lines need to be updated: 

    # Set max memory to 1 Gb
    memory_limit = 1024M
    
    # Set the max file upload size to 10 Megabytes
    upload_max_filesize = 10M
    
    # This would need to be set to the timezone in which the Server is located
    date.timezone = America/Detroit
  7. Install the PHP modules required by PCR-360 

    yum -y install php72-php-process php72-php-xml php72-php-pecl-apcu php72-php-gd php72-php-intl php72-php-mbstring php72-php-pecl-mcrypt php72-php-pdo php72-php-soap php72-php-pecl-zip
     
    # Optional (installation dependant) Packages
     
    # MySql support
    yum -y install php72-php-mysqlnd
     
    # LDAP Support
    yum -y install php72-php-ldap
    1. If you experience an issue with installing dependencies for the Modules, you will either need to compile them yourself, or install the centos repo: 

      vim /etc/yum.repos.d/centos.repo
      
      
      [centos]
      name=CentOS $releasever - $basearch
      baseurl=http://ftp.heanet.ie/pub/centos/6/os/$basearch/
      enabled=1
      gpgcheck=0
  8. Install OCI8 Support ONLY if this is an Oracle Load:
    1. Support for this will require you Update the Oracle Instant Client to at at least version 18.1

    2. You will likely need to remove previous versions of SQL Plus 

      # This command will vary depending on the version installed 
      rpm -e oracle-instantclient12.1-sqlplus-12.1.0.2.0-1.x86_6
    3. Start Here: Instant Client Install

    4. /wiki/spaces/PCRIN/pages/17266319hen install the PHP72 Mod

      # Oracle Support
      yum -y install php72-php-oci8
  9. The defaults settings for PHP-FPM should be ok, but if you need to change anything (i.e. listening port), the config can be found at: 

    /etc/opt/remi/php72/php-fpm.d/www.conf

    The default listening port may be changed at the following line 

    listen = 127.0.0.1:9000
  10. Edit the Virtual Host configuration. This is generally located in the default Virtual Hosts directory: 

    /etc/httpd/conf.d/<vhost_name>.conf


    1. For Apache Version 2.2, two new directives need to be added:
      1. The placement of the new lines is especially important in Shibboleth configurations
      2. Just below the <Directory> directive, add the <Location> directive
      3. Just below the newly added <Location> directive, add the ProxyPassMatch 

        # DIRECTORY-based Setup: This is the most common used on customer loads
        <VirtualHost>
            # This is just an example ServerName. The value should already be present and does not need to be altered
            ServerName servername.domain.com 
        
            ...
        
            <Directory /var/www/pcr360/test/public>
            	...
            </Directory>
        
            # Just below the <Directory> directive, add the <Location> directive
            # Proxy to php72 on fpm
            <Location />
                Order allow,deny
                Allow from all
            </Location>
        
            # Just below the newly added <Location> directive, add the ProxyPassMatch 
            ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/var/www/pcr360/test/public/$1 disablereuse=off timeout=900
         
            ...
        </VirtualHost>
    2. For Apache Version 2.4
      1. Tell PHP-FPM to listen to the socket. Edit /etc/opt/remi/php72/php-fpm.d/www.conf and change the line listen= ... to: 

        listen = /var/run/php72.sock
      2. Find the listen.owner / .group / .mode lines and un-comment them. Also, change the user & group to whatever Apache runs as (usually "apache"). 

        listen.owner = apache
        listen.group = apache
        listen.mode = 0660
      3. Declare the proxy in a separate .conf file so we can re-use it. i.e.  /etc/httpd/conf.d/php72.conf 

        <Proxy "unix:/var/run/php72.sock|fcgi://php-fpm72">
         ProxySet disablereuse=off
         ProxySet timeout=900
        </Proxy>
      4. Edit the PCR360 <VirtualHost> and add the <FilesMatch> & SetHandler

        <VirtualHost>
         # This is just an example ServerName. The value should already be present and does not need to be altered
         ServerName servername.domain.com 
         ...
         <FilesMatch \.php$>
         SetHandler proxy:fcgi://php-fpm72
         </FilesMatch>
         ...
        </VirtualHost>


  11. Start the FPM service 

    # RedHat 6 and CentOS 6
    service php72-php-fpm start
    
    # RedHat 7 and CentOS 7
    systemctl start php72-php-fpm
  12. Verify the the service is listening on the configured port (default is 9000). 

    netstat -plnt
     
    Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name
    tcp        0      0 127.0.0.1:9000              0.0.0.0:*                   LISTEN      4262/php-fpm
  13. Enable the FPM service. Restart Apache and PHP 

    # RedHat 6 and CentOS 6
    chkconfig php72-php-fpm on && service httpd restart && service php72-php-fpm restart
    
    # RedHat 7 and CentOS 7
    systemctl enable httpd php72-php-fpm && systemctl restart httpd php72-php-fpm
  14. The application code can now be updated to version 2018.1+

Help Desk Portal - Email: help@pcr.com - Phone: 616.259.9242