SOLVED PECL install keeps defaulting to wrong PHP version

Cambreaker

Member
Sep 8, 2022
9
1
3
Florida
cPanel Access Level
Root Administrator
I've had our website's server operation foisted onto my plate, I have very little experience, mostly just looking things up on google.
I am trying to upgrade my domain from php73 to php74 (using MultiPHP in cPanel). Php74 won't boot because it can't find imagick.so.

I have imagick installed and working fine on 73, but I can't seem to get it to install to 74. I've tried usr/local/cpanel/3rdparty/php/74/bin/pecl install imagick, (which is how I got it on 73 some months ago), and I've tried the WHM Modules Installer with the PHP Version and Include Path set to php74, but they both install to php73, even if I have switched all subdomains to 74 in Multiphp. I've uninstalled from 73, switched to 74, and tried installing, but it always installs to 73 which means 74 can never properly boot. To add insult to injury, I can't even find where the imagick.so extension is being called from by grep in the php74 directory. What am I missing? Thanks in advance for your replies, and patience with my inexperience.
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
14,241
2,217
363
cPanel Access Level
Root Administrator
Hey there! That command you provided worked well for me on my system without needing to do anything else. I confirmed this with a PHP Info page on the domain, and it had the "imagick" section for PHP 7.4

The specific include gets added to /opt/cpanel/ea-php74/root/etc/php.d/zzzzzzz-pecl.ini, as that has the extension listed. The actual file should be in /opt/cpanel/ea-php74/root/usr/lib64/php/modules/imagick.so if you'd like to check and see if that is there.

Did you get a positive confirmation from the Pecl install command? That output should have this as the last few lines:

Code:
Build process completed successfully
Installing '/usr/local/cpanel/3rdparty/php/74/include/php/ext/imagick/php_imagick_shared.h'
Installing '/usr/local/cpanel/3rdparty/php/74/lib/php/extensions/no-debug-non-zts-20190902/imagick.so'
install ok: channel://pecl.php.net/imagick-3.7.0
configuration option "php_ini" is not set to php.ini location
You should add "extension=imagick.so" to php.ini
although we add the "extension" code mentioned automatically.
 

Cambreaker

Member
Sep 8, 2022
9
1
3
Florida
cPanel Access Level
Root Administrator
zzzzzzz-pecl.ini exists and has
extension="imagick.so"
extension=imagick.so
But the /opt/cpanel/ea-php74/root/usr/lib64/php/modules/imagick.so does NOT exist, only in ea-php73. I think the only reason the pecl.ini has the imagick extension listed is because I created it manually when I first configured the module (for php73). I DO get the build completed successfully messages, but it always confirms the installation in php/73/, no matter what I do to try and prompt it to install in 74.

Also, when I try to use the code </> tag button, it just pops up a forum list instead of tagging the highlighted text, sorry :(
 

Cambreaker

Member
Sep 8, 2022
9
1
3
Florida
cPanel Access Level
Root Administrator
I received a resolution from support, sharing here for posterity!
cPanel Support said:
I found that your PECL service had configuration that was forcing PHP 7.3 to be used for the installation directory, even for PHP 7.4. This configuration is found here:
Code:
[18:55:16 tra [email protected] ~]cPs# /opt/cpanel/ea-php74/root/bin/pecl config-show | grep -i php73
PEAR executables directory     bin_dir          /opt/cpanel/ea-php73/root/usr/bin
PHP CLI/CGI binary             php_bin          /opt/cpanel/ea-php73/root/usr/bin/php
php.ini location               php_ini          /opt/cpanel/ea-php73/root/etc/php.ini
When PECL would begin its process, it would use these PHP directories to be used instead of the version you specified, resulting in the extension being built for PHP 7.3.

To resolve this, I simply moved this configuration file out of the way:
Code:
[18:59:30 tra [email protected] ~]cPs# mv -v /root/.pearrc{,.bak}
‘/root/.pearrc’ -> ‘/root/.pearrc.bak’
cPanel will manage your PECL configuration and this file is not normally required except for advanced requirements for PECL. As such, it is safe for this file to be disabled in this way.

With this completed, attempting to install IMagick for PHP 7.4 showed success