Search Engine: Elastic

Article ID: 128685, created on Apr 17, 2016, last review on Jul 26, 2016

  • Applies to:
  • Plesk Automation 11.5


Some applications like Magento require PHP 5.5 (or higher) handler version with mcrypt and intl PHP extensions. I have compiled PHP 5.6.3 according to How to enable multiple PHP versions in Plesk Automation, but didn't enable some extensions. How can I install it for registered PHP handler without recompilation?


In order to add extension to already compiled PHP handler 2 options are possible:

A. Install extension using PECL

This method allows to enable intl support. The installation includes the following main steps:

  1. Install required dependencies:

    [root@pa115apachemysql2 ~]# yum -y install icu libicu libicu-devel
  2. Locate PHP563 handler utility:

    [root@pa115apachemysql2 ~]# updatedb
    [root@pa115apachemysql2 ~]# locate pecl | grep "php563-cgi/bin"
  3. Install required PHP extension (Do not change default settings):

    [root@pa115apachemysql2 ~]# /usr/local/php563-cgi/bin/pecl install intl
    downloading intl-3.0.0.tgz ...
    Starting to download intl-3.0.0.tgz (248,200 bytes)
    ....................................................done: 248,200 bytes
    150 source files, building
    running: phpize
    Configuring for:
    PHP Api Version:         20131106
    Zend Module Api No:      20131226
    Zend Extension Api No:   220131226
    Specify where ICU libraries and headers can be found [DEFAULT] :

    Output result:

    Build process completed successfully
    Installing '/usr/local/php563-cgi/lib/php/extensions/no-debug-non-zts-20131226/'
    install ok: channel://
    configuration option "php_ini" is not set to php.ini location
    You should add "" to php.ini
  4. Now we need to enable intl support on server wide level:

    4.1. Get config-file-scan-dir option:

    [root@pa115apachemysql2 ~]# /usr/local/php563-cgi/bin/php-cgi phpinfo | grep -ir "with-config-file-scan-dir"

    4.2. Create this directory if it does not exist:

    [root@pa115apachemysql2 ~]# mkdir -p /usr/local/php563-cgi/php.d

    4.3. Create configuration file for intl module:

    [root@pa115apachemysql2 ~]# touch /usr/local/php563-cgi/php.d/intl.ini
    [root@pa115apachemysql2 ~]# vim /usr/local/php563-cgi/php.d/intl.ini
    [root@pa115apachemysql2 ~]# cat /usr/local/php563-cgi/php.d/intl.ini
    ; Enable intl extension module

    4.4. Make sure that compiled exists in /usr/local/php563-cgi/lib/php/extensions/no-debug-non-zts-20131226/ (from step 3)

    [root@pa115apachemysql2 ~]# ls -laht /usr/local/php563-cgi/lib/php/extensions/no-debug-non-zts-20131226/
    -rw-r--r-- 1 root root 2.3M Feb 13 17:49 /usr/local/php563-cgi/lib/php/extensions/no-debug-non-zts-20131226/
  5. Restart Apache on the node in order to apply changes:

    [root@pa115apachemysql2 ~]# /etc/init.d/httpd restart
    Stopping httpd:                                            [  OK  ]
    Starting httpd:                                            [  OK  ]
  6. Make sure that intl extension is loaded:

    [root@pa115apachemysql2 ~]# /usr/local/php563-cgi/bin/php-cgi -c /usr/local/php563-cgi/php.ini -m | grep intl

B. Compiling shared PECL extensions with phpize

mcrypt extension can not be installed using PECL utility, because it's package is missing in repo's.:

[root@pa115apachemysql2 ~]# /usr/local/php563-cgi/bin/pecl install mcrypt
No releases available for package ""
install failed

So we need to compile manually. It could be done by following steps:

From KB

    # cd /usr/local/src
    # wget
    # tar xjvf php-5.6.3.tar.bz2
    # mv php-5.6.3 php563

Installation files are located at /usr/local/src/php563/ext/mcrypt.

  1. Change directory to mcrypt where is source files are located:

    [root@pa115apachemysql2 ~]# cd /usr/local/src/php563/ext/mcrypt
    [root@pa115apachemysql2 mcrypt]# pwd
  2. We need to install libmcrypt package, but it's not available in default CentOS repos, :

    [root@pa115apachemysql2 mcrypt]# yum install libmcrypt libmcrypt-devel
    Loaded plugins: fastestmirror
    Setting up Install Process
    Loading mirror speeds from cached hostfile
     * base:
     * extras:
     * updates:
    No package libmcrypt-devel available.
    Nothing to do

    2.1. SEnable epel repository:

    [root@pa115apachemysql2 mcrypt]# yum -y install epel-release

    2.2. Make sure that mail epel repository is enabled:

    [root@pa115apachemysql2 mcrypt]# grep -i "enabled" /etc/yum.repos.d/epel.repo

    2.3. Install required packages:

    [root@pa115apachemysql2 mcrypt]# yum install libmcrypt libmcrypt-devel
  3. Now we can prepare from source files:

    3.1. Check current directory once again (it's important):

    [root@pa115apachemysql2 mcrypt]# pwd

    3.2. Locate phpize utility for corresponding PHP handler:

    [root@pa115apachemysql2 mcrypt]# locate phpize

    3.3. Run it:

    [root@pa115apachemysql2 mcrypt]# /usr/local/php563-cgi/bin/phpize
    Configuring for:
    PHP Api Version:         20131106
    Zend Module Api No:      20131226
    Zend Extension Api No:   220131226

    3.4. Run following commands (/usr/local/php563-cgi/bin/php-config is usually located at the same path with compiled PHP binaries):

    [root@pa115apachemysql2 mcrypt]# locate php-config
    [root@pa115apachemysql2 mcrypt]# ./configure --with-php-config=/usr/local/php563-cgi/bin/php-config
    [root@pa115apachemysql2 mcrypt]# make
    [root@pa115apachemysql2 mcrypt]# make install
    Installing shared extensions:     /usr/local/php563-cgi/lib/php/extensions/no-debug-non-zts-20131226/
  4. Create configuration file for mcrypt:

    [root@pa115apachemysql2 mcrypt]# touch /usr/local/php563-cgi/php.d/mcrypt.ini
    [root@pa115apachemysql2 mcrypt]# vim /usr/local/php563-cgi/php.d/mcrypt.ini
    [root@pa115apachemysql2 mcrypt]# cat /usr/local/php563-cgi/php.d/mcrypt.ini
    ; Enable mcrypt extension module
  5. Make sure that compiled exists in /usr/local/php563-cgi/lib/php/extensions/no-debug-non-zts-20131226/ (from step 3.4)

    [root@pa115apachemysql2 mcrypt]# ls -laht /usr/local/php563-cgi/lib/php/extensions/no-debug-non-zts-20131226/
    -rwxr-xr-x 1 root root 147K Feb 13 18:24 /usr/local/php563-cgi/lib/php/extensions/no-debug-non-zts-20131226/
  6. Restart Apache on the node in order to apply changes.

33a70544d00d562bbc5b17762c4ed2b3 caea8340e2d186a540518d08602aa065 e0aff7830fa22f92062ee4db78133079

Email subscription for changes to this article
Save as PDF