How do I make Imagemagick work when I have 3 versions of PHP installed?


How do I make Imagemagick work for each of the 3 PHP versions I have installed?

My Environment

CentOS 7
PHP versions 5.4, 5.5, and 5.6 installed and working
Have Imagemagick 6 installed and working for the default version of PHP 5.4 that comes with CentOS 7
Webmin/Virtualmin (similar to Pleask) is being used to handle the shared hosting and select what verion of PHP to use per site

For reference on how I installed PHP 5.6, here are the command I ran to install PHP 5.6.
yum install rh-php56
yum install rh-php56-php-mysqlnd rh-php56-php-gd rh-php56-php-xmlrpc rh-php56-php-bcmath rh-php56-php-mbstring rh-php56-php-pecl-xdebug rh-php56-php-xdebug-debuginfo rh-php56-php-pspell rh-php56-php-soap rh-php56-php-intl rh-php56-php-pecl-jsonc-debuginfo rh-php56-php-pecl-xdebu-debuginfo rh-php56-php-recode
scl enable rh-php56 bash

Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

yum provides */ ?
matt1237Author Commented:
This is the process that I used to install the PHP extension on all three versions of PHP installed on my system. I adapted the solution from this website to work for multiple versions of PHP.

First I installed the additional PHP stuff needed:
yum install rh-php56-php-devel php55-php-devel php-devel

Open in new window

Then I installed the ImageMagick stuff:
yum install ImageMagick ImageMagick-devel

Open in new window

SSH into server with the CLI set to use PHP 5.6 and do this (your exact path may vary). Here's a little link to the method I used to set the CLI PHP version.
[root@server ~]# pecl install imagick
[root@server ~]# echo "" > /etc/opt/rh/rh-php56/php.d/imagick.ini

Open in new window

SSH into server with the CLI set to use PHP 5.5 and do this (your exact path may vary)...
[root@server ~]# pecl install imagick
[root@server ~]# echo "" > /opt/rh/php55/root/etc/php.d/imagick.ini

Open in new window

SSH into server with the CLI set to use PHP 5.4 and do this (your exact path may vary)...
[root@server ~]# pecl install imagick
[root@server ~]# echo "" > /etc/php.d/imagick.ini

Open in new window

Finally I restarted apache and everything should work.
[root@server ~]# systemctl restart httpd.service

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
matt1237Author Commented:
I've requested that this question be closed as follows:

Accepted answer: 0 points for matt1237's comment #a40943495

for the following reason:

gheist, "yum provides */" didn't seem to work for me. Maybe it's different for CentOS 7 or something. I also tried "yum provides */" but that didn't work either so I accepted my solution as the one that worked.
IT Pros Agree: AI and Machine Learning Key

We’d all like to think our company’s data is well protected, but when you ask IT professionals they admit the data probably is not as safe as it could be.

matt1237Author Commented:
Please do not delete this solution but accept my solution as the correct one. I provided a very detailed solution that I would really like to be kept as a record of how to fix this issue... there are no other solutions like this currently on the web.
You did not accept your solution :S

Normally one enabled php from scl like
scl enable php57 bash
pecl install blahblah
(man scl for more info)

yum provides returing empty just says PHP imagemagick is not provided from standard repos.
matt1237Author Commented:
Thanks for the reply
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.