0

I just bought a VPS and it came with PHP5.3.3 and that wasn't good for our website, so I successfully (so it seemed, anyway) installed PHP5.6.7 and successfully registered it with Plesk.

For the website in question, I chose 5.6.7 in Plesk's hosting settings and everything worked fine. I can see by looking at phpinfo() that the correct version is being used.

After I was happy with that, I went on to install imagick and memcache, two other extensions needed for our site. Both seemed to install fine without any errors and added the extensions to the correct php.ini file (getting the correct path from phpinfo) and restarted apache:

extension=memcache;
extension=imagick;

$ service httpd restart

This is where I see things going wrong. I check phpinfo and the extensions are not visible, and I confirm this in my application:

if (extension_loaded('imagick')) {
    echo 'IMagick extension loaded okay.';
} else {
    echo 'IMagick extension not loaded! Meh!';
}

I then ran this command to find out which folder was being used for extensions:

$ php-config --extension-dir

It returns:

/usr/lib64/php/modules

But when I check my phpinfo for extensions_dir it that has this:

/php/php-5.6.7/lib/php/extensions/no-debug-non-zts-20131226

I then investgated more by seeing which of these extension directories had an imagick.so extension; /usr/lib64/php/modules had the extension but the directory phpinfo is saying it should be in doesn't have the extension. I also confirmed this by going into Plesk and switching back to 5.3.3 and checked what phpinfo said. Both the extensions I installed were listed and worked fine! It installed ok, but for the wrong PHP version it seems.

I thought I would try copying the extension from where it is, to where it should be:

$ cp /usr/lib64/php/modules/imagick.so /php/php-5.6.7/lib/php/extensions/no-debug-non-zts-20131226/imagick.so

And tested that the file existed in the new folder before restarting httpd - but again, without any luck.

It's very clear that the extensions, and possibly the modules, were installed into PHP5.3.3 directories, and not 5.6.7, but how did it happen? Should I have changed into cd /php/php-5.6.7 directory first and then ran the install commands? These are similar commands I used to install imagick, right after logging in as root:

$ yum install ImageMagick ImageMagick-devel
$ pecl install imagick
$ echo "extension=imagick.so" > /etc/php.d/imagick.ini

Can somebody very kindly share with me the commands needed to run a fresh, new imagick install, but to the correct PHP version? Or maybe share a way to easily fix the problem as it is?

I really appreciate any help to get me over the line on this problem.

This is the GIST I used for installing PHP5.6.7, in case that helps:

https://gist.github.com/Stayallive/dbb91ffa6f0fc6ca6ac3

0

Uninstall PHP5.3.3 and than install imagemagic. Read what yum is printing on screen (if it is not trying to install PHP5.3.3 again).

P.S. I just read what have you really done. You have compiled PHP5.6 and it is out of package manager support. Why did you need PHP5.6? You can have PHP5.4 on CentOS without compiling anything.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.