Installed Imagick error class 'Imagick' not found

neekfenwick

Registered
Jun 23, 2017
2
0
1
Thailand
cPanel Access Level
Root Administrator
Helped me build the correct API version.
I've followed these same steps on Centos 7, EasyApache4, no joy getting ImageMagick to work. I have to provide complete path to pecl since it seems specific to the php version being used:

Code:
/usr/local/cpanel/3rdparty/php/56/bin/pecl config-set bin_dir /opt/cpanel/ea-php56/root/usr/bin/
/usr/local/cpanel/3rdparty/php/56/bin/pecl config-set php_bin /opt/cpanel/ea-php56/root/usr/bin/php/
usr/local/cpanel/3rdparty/php/56/bin/pecl config-set php_ini /opt/cpanel/ea-php56/root/etc/php.ini
pecl install imagick
The output ends with:

Code:
Build process completed successfully
Installing '/opt/cpanel/ea-php56/root/usr/lib64/php/modules/imagick.so'
Installing '/opt/cpanel/ea-php56/root/usr/include/php/ext/imagick/php_imagick_shared.h'
install ok: channel://pecl.php.net/imagick-3.4.3
configuration option "php_ini" is not set to php.ini location
You should add "extension=imagick.so" to php.ini
I have added extension=imagick.so to /opt/cpanel/ea-php56/root/etc/php.ini and restarted apache, but my script stil fails with:

Code:
[23-Jun-2017 11:26:33 UTC] PHP Fatal error:  Class 'Imagick' not found in /home/user/blah/file.php on line 87
Any hints?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,261
463
Hello,

Could you upload a PHPINFO file to the same directory of the script you are using to test the installation with to verify it uses the /opt/cpanel/ea-php56/root/etc/php.ini file? If not, you'd need to use the MultiPHP INI Editor in cPanel for this account to ensure "extension=imagick.so" is added.

Thank you.
 

neekfenwick

Registered
Jun 23, 2017
2
0
1
Thailand
cPanel Access Level
Root Administrator
Thanks cPanelMichael,

I remain at a bit of a loss. I tested with phpinfo() already in that website, it shows:
Code:
Loaded Configuration File /opt/cpanel/ea-php56/root/etc/php.ini
I loaded MultiPHP INI Editor as you suggested, and found my 'extension=imagick.so' was the first line in the file for some reason. I moved it to below the 'Dynamic Extensions' comment in the file (around line 860) where it looked like it belonged, restarted apache server, but still got "Class 'Imagick' not found".

phpinfo also shows me:
Code:
extension_dir /opt/cpanel/ea-php56/root/usr/lib64/php/modules
And 'locate imagick.so' shows:
Code:
# locate imagick.so
/opt/cpanel/ea-php56/root/usr/lib64/php/modules/imagick.so
So that looks good. As the ini file contains:
Code:
; If you only provide the name of the extension, PHP will look for it in its
; default extension directory.
So just for completeness I tried specifying the full path to the .so:
Code:
extension="/opt/cpanel/ea-php56/root/usr/lib64/php/modules/imagick.so"
I also put a logging line in the actual script I'm running (called UploadFile.php) to be sure nothing in the bootstrap process of the cart I'm using is overwriting these settings other than what phpinfo() shows:
Code:
[24-Jun-2017 03:19:52 UTC] modules include path: /opt/cpanel/ea-php56/root/usr/lib64/php/modules
Seems fine. I'm going to google around more about how the 'Imagick' class is supposed to be made available to the PHP code. Is it enough to have the .so file on the extension_dir path, or is there some .php file required somewhere, like a C .h header file would be required as well as the .so? I cannot see any Imagick files in the include_path folder.
Code:
include_path   .:/opt/cpanel/ea-php56/root/usr/share/pear
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,261
463
Hello,

Feel free to open a support ticket using the link in my signature if you'd like us to take a closer look.

Thank you.