Install imagick in PHP 5.5. and 5.6 with EasyApache 4

did-vmonroig

Well-Known Member
Feb 6, 2012
66
4
58
cPanel Access Level
Root Administrator
We've switched to EasyApache 4 in order to have PHP 5.5 and 5.6 available for our clients.

Some of them need imagick library, working at least in PHP 5.5. I can't find a rpm available for this module, PECL is now broken and manual installation fails because phpize has no headers for the new PHP homes.

How should I proceed?

Thanks in advance.
 

JacobPerkins

Well-Known Member
May 2, 2014
617
97
103
cPanel Access Level
DataCenter Provider
Twitter
Hi,

In the PECL binary, you can simply remove the '-n' from the binary itself:
Code:
[email protected] [~]# diff /usr/local/bin/pecl pecl
28c28
< exec $PHP -C -n -q $INCARG -d date.timezone=UTC -d output_buffering=1 -d variables_order=EGPCS -d safe_mode=0 -d register_argc_ar
gv="On" $INCDIR/peclcmd.php "[email protected]"
---
> exec $PHP -C -q $INCARG -d date.timezone=UTC -d output_buffering=1 -d variables_order=EGPCS -d safe_mode=0 -d register_argc_argv=
"On" $INCDIR/peclcmd.php "[email protected]"
This will allow you to use the PECL binary from the command line. You should be able to install those modules after making this change :D

Let me know how it goes. Thanks!
 
  • Like
Reactions: Ali Shahnazi

did-vmonroig

Well-Known Member
Feb 6, 2012
66
4
58
cPanel Access Level
Root Administrator
Thanks for your help. With your change PECL seems to work:

Code:
# pecl install imagick

.
.
.

Build process completed successfully
Installing '/usr/local/include/php/ext/imagick/php_imagick_shared.h'
Installing '/usr/local/lib/php/extensions/no-debug-non-zts-20090626/imagick.so'
install ok: channel://pecl.php.net/imagick-3.3.0
Extension imagick enabled in php.ini
But this server uses EasyApache 4, so extension hasn't been enabled for webs, as it uses another PHP.INI. I've copied library from /usr/local/lib/php/extensions/no-debug-non-zts-20090626/imagick.so to /opt/cpanel/ea-php55/root/usr/lib64/php/modules/ and created /opt/cpanel/ea-php55/root/etc/php.d/imagick.ini, with this content:

Code:
; Enable imagick extension module
extension=imagick.so
After an httpd restart, this is the new problem:

Code:
PHP Warning:  PHP Startup: imagick: Unable to initialize module
Module compiled with module API=20090626
PHP    compiled with module API=20121212
These options need to match
 in Unknown on line 0
 

did-vmonroig

Well-Known Member
Feb 6, 2012
66
4
58
cPanel Access Level
Root Administrator
Just for the record, I couln't manage to recompile properly imagick.

Reverted back to EasyApache 3 and I'll be far from it while it's work in progress. Our clients will have to wait for multihome PHP.
 

MastricX

Member
Aug 29, 2009
9
0
51
Removed the -n in /usr/local/bin/pecl

pecl config-set bin_dir /opt/cpanel/ea-php56/root/usr/bin/
pecl config-set php_bin /opt/cpanel/ea-php56/root/usr/bin/php
pecl config-set php_ini /opt/cpanel/ea-php56/root/etc/php.ini

pecl install imagick

Helped me build the correct API version.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,904
2,237
463
Helped me build the correct API version.
Hello,

I'm happy to see that solution worked well. Thank you for updating this thread with the outcome.