Search code examples
centos7php-5.5

Install PHP 5.5 on Centos 7


I have a Centos 7 server running apache 2.4.6 and php 5.4. I'm trying to install Magento 2 on my server for a client but am having issues.

I need to have PHP 5.5 or 5.6 installed on my server for Magento 2 to run. I cannot figure out how to upgrade to PHP 5.5 or PHP 5.6.

I don't know the difference between the two versions, so I'll take whatever I can get working !

Thanks :)


Solution

  • This is the procedure for PHP 5.6.

    I was able to upgrade PHP 5.4.16 on CENTOS7 to version 5.6.25 with these simple steps. Important to note that i used the Software Collection Repositories.

    1- Install All these new packages:

    • yum install centos-release-scl
    • yum install rh-php56
    • yum install rh-php56-php
    • yum install rh-php56-php-pdo
    • yum install rh-php56-php-devel
    • yum install rh-php56-php-mysql
    • yum install rh-php56-php-fpm

    2- Make apache 2.4 use php-fpm

    Edit that file: /etc/httpd/conf.d/php.conf Put that content:

    <FilesMatch \.php$>
    #    SetHandler application/x-httpd-php
        SetHandler "proxy:fcgi://127.0.0.1:9000"
    </FilesMatch>
    

    3- Reboot services to handle php-fpm:

    • systemctl restart rh-php56-php-fpm
    • systemctl restart httpd

    4- Enabling rh-php56-php-fpm service on boot time

    • systemctl enable rh-php56-php-fpm
    • systemctl enable httpd

    5- Create a symlink for the new php version.

    • mv /usr/bin/php /usr/bin/phpOLD
    • ln -s /opt/rh/rh-php56/root/bin/php /usr/bin/php