How can I install PHP 5.5+ alongside php 5.3 (or 5.4 with the EPEL repository) on a Centos 6 server?

I don't want to remove or supersede the default version, but I would like to have both versions installed and use the Apache AddHandler directive to selectively have certain virtual hosts use the more modern version of PHP. I'd like the default version to remain 5.3 (or 5.4 with the EPEL repository).

Is there a way to do this that involves a reputable repository, or am I going to have to compile and maintain the newer version of PHP manually?

  • I don't think you can have two versions of mod_php loaded, so one or both will have to be via fastcgi. – Michael Hampton Jun 30 '15 at 16:55

I'm not sure whether you can via Apache, but I do know you can with OpenLiteSpeed.



I've used (Open)LiteSpeed many times as a drop-in replacement (with more stable performance) over Apache and used that multi-PHP feature many times over. I'd run various pieces of software like Magento, SugarCRM and WordPress on the same server, each with different PHP requirements. This way, you can tell "serve this site with this PHP version and parameters, and that one with the other PHP version."

Nginx should also be possible as you can define different upstream sockets for say PHP-FPM, HHVM per location/server.

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.