• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Issue PHP extension problem for multiple PHP versions

John S.

New Pleskian
I cannot add PHP extensions for any version higher than 5.4. This is the problem I am experiencing, step-by-step:

1. Switch to PHP 5.5.38 in Domain->PHP Settings
2. Add a few installed extensions to the 'Additional configuration directives ' on PHP settings page, e.g.
extension=stats.so
extension=trader.so
expose_php = Off
extension=apc.so
3. Save it, then reconfigure the domain, restart httpd and nginx.
4. These added extensions appear in php.ini in
/var/www/vhosts/system/mydomaincom/etc
5. But nothing works, these extensions are not shown in phpinfo() and not enabled.
6. I also tried adding these directive directly to master php.ini in
/opt/plesk/php/5.5/etc
--- the same issue, it doesn't work. I tried both FPM and FastCGI

The same scenario works perfectly find for PHP 5.4.

Pls help.

Thanks!
 
PHP extensions should be enabled in Tools&Settings>PHP Settings>PHPxx
 
PHP extensions should be enabled in Tools&Settings>PHP Settings>PHPxx
I don't see any extensions I installed via pecl in Tools&Settings>PHP Settings>PHPxx[

I installed them directly via ssh. They are shown on php command line (#php -m) and can be enabled for PHP 5.4.45. For all other higher versions it doesn't work.

I also tried to add:

Code:
extension_dir=/usr/lib64/php/modules

but it also doesn't enable these extensions
 
Here a lot of instructions how to compile different php modules for different Plesk php versions, try to find them and compare with your method. For example Resolved - memcache 3.0.8 for PHP 5.6 on Ubuntu 16.04
Thanks - I am trying to it as you suggested and this is the output:
Code:
# /opt/plesk/php/5.5/bin/pecl install trader

Warning: Invalid argument supplied for foreach() in PEAR/Downloader.php on line 573
PHP Warning:  Invalid argument supplied for foreach() in /opt/plesk/php/5.5/share/pear/PEAR/Downloader.php on line 573
downloading trader-0.5.0.tgz ...
Starting to download trader-0.5.0.tgz (299,829 bytes)
.............................................................done: 299,829 bytes

Warning: Invalid argument supplied for foreach() in PEAR/PackageFile/v2/Validator.php on line 870
PHP Warning:  Invalid argument supplied for foreach() in /opt/plesk/php/5.5/share/pear/PEAR/PackageFile/v2/Validator.php
 on line 870
332 source files, building
WARNING: php_bin /opt/plesk/php/5.5/bin/php appears to have a suffix /5.5/bin/php, but config variable php_suffix does n
ot match
running: phpize
Configuring for:
PHP Api Version:         20121113
Zend Module Api No:      20121212
Zend Extension Api No:   220121212
shtool at '/tmp/trader/build/shtool' does not exist or is not executable.
Make sure that the file exists and is executable and then rerun this script.

ERROR: `phpize' failed
 
This is another out for stats pecl extension:

Code:
# /opt/plesk/php/5.5/bin/pecl install stats
downloading stats-1.0.5.tgz ...
Starting to download stats-1.0.5.tgz (112,361 bytes)
.........................done: 112,361 bytes
17 source files, building
WARNING: php_bin /opt/plesk/php/5.5/bin/php appears to have a suffix /5.5/bin/php, but config variable php_suffix does n
ot match
running: phpize
Configuring for:
PHP Api Version:         20121113
Zend Module Api No:      20121212
Zend Extension Api No:   220121212
shtool at '/tmp/stats/build/shtool' does not exist or is not executable.
Make sure that the file exists and is executable and then rerun this script.

Any suggestions?
 
No any problem with trader installation for me with

# yum install gcc make plesk-php55-devel
# /opt/plesk/php/5.5/bin/pecl install trader
# echo "extension=trader.so" > /opt/plesk/php/5.5/etc/php.d/trader.ini
# /usr/local/psa/bin/php_handler --reread

And check finally:

# /opt/plesk/php/5.5/bin/php -m | grep trader
trader
 
With the same method:

# /opt/plesk/php/5.5/bin/php -m | grep stats
stats

:)
 
I have managed to install all extensions except APC. It returns the following error at the end, after a long cmpile code:

Code:
#/opt/plesk/php/5.5/bin/pecl install apc
.....................................
......................................
.....................................
.....................................
/root/tmp/APC/apc_compile.c: In function ƒmy_copy_class_entryƒ:
/root/tmp/APC/apc_compile.c:755: warning: assignment from incompatible pointer type
/root/tmp/APC/apc_compile.c: In function ƒapc_copy_class_entry_for_executionƒ:
/root/tmp/APC/apc_compile.c:1956: warning: assignment from incompatible pointer type
/root/tmp/APC/apc_compile.c: In function ƒapc_copy_trait_aliasƒ:
/root/tmp/APC/apc_compile.c:2379: error: ƒzend_trait_aliasƒ has no member named ƒfunctionƒ
/root/tmp/APC/apc_compile.c:2380: error: ƒzend_trait_aliasƒ has no member named ƒfunctionƒ
/root/tmp/APC/apc_compile.c:2380: error: ƒzend_trait_aliasƒ has no member named ƒfunctionƒ
/root/tmp/APC/apc_compile.c: In function ƒapc_copy_trait_precedenceƒ:
/root/tmp/APC/apc_compile.c:2416: error: ƒzend_trait_precedenceƒ has no member named ƒfunctionƒ
/root/tmp/APC/apc_compile.c:2417: error: ƒzend_trait_precedenceƒ has no member named ƒfunctionƒ
/root/tmp/APC/apc_compile.c:2417: error: ƒzend_trait_precedenceƒ has no member named ƒfunctionƒ
make: *** [apc_compile.lo] Error 1
ERROR: `make' failed

Any suggestions how to fix it?
 
BTW, PHP 5.5 has built-in opcode optimizer OPcache making APC obsolete.
According to APC changelogs, PHP up to only 5.4 is supported.
 
Back
Top