3

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 :)

4 Answers 4

5

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
Sign up to request clarification or add additional context in comments.

3 Comments

I also installed gd extension: yum install rh-php56-php-gd
Good but symlinks and SetHandler look overkill to me, a lighter weight solution is to just rename some conf files under /etc/httpd/conf* as suggested in doc.owncloud.org/server/8.2/admin_manual/installation/…
In addition to these packages, I need to install mbstring. I imagine that this will vary for each users needs, but the important thing to note with each new package is that you have to restart php-fpm along with apache to see the modules take effect.
1

Run this in your terminal: wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm wget http://rpms.famillecollet.com/enterprise/remi-release-7.rpm rpm -Uvh remi-release-7*.rpm epel-release-7*.rpm

Then : sudo yum install php php-gd php-mysql php-mcrypt

and you should have php 5.5

4 Comments

You need to enable the "remi-php55" repository to get it, before the yum install command: yum-config-manager --enable remi-php55
@RemiCollet Thanks for that :)
I ran all of these, including the command @RemiCollet said to run.. I then restarted httpd and when I run php -v it still says PHP 5.4.16 (cli) (built: Jun 23 2015 21:17:27)
"yum repolist" and "rpm -qa 'php*'" will help
0

This is the procedure for PHP 7.3

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

1- install this alone

yum install centos-release-scl 

2- then run this

yum install rh-php73 yum install rh-php73-php yum install rh-php73-php-pdo yum install rh-php73-php-devel yum install rh-php73-php-mysqlnd yum install rh-php73-php-fpm 

3- 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> 

4- Reboot services to handle php-fpm:

systemctl restart rh-php73-php-fpm systemctl restart httpd 

5- Enabling rh-php73-php-fpm service on boot time

systemctl enable rh-php73-php-fpm systemctl enable httpd 

6- Create a symlink for the new php version.

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

Comments

-2

Steps (Use sudo only if required)

1) Remove OLD Apache

sudo service httpd stop sudo yum erase httpd httpd-tools apr apr-util 

2) Remove OLD PHP

sudo yum remove php-* 

if it´s a clean installation start from here:

3) Install PHP 5.6 (Apache 2.4 will be automatically installed with this)

sudo yum install php56 

4) Make sure all the required PHP extensions are installed

yum list installed | grep php 

5) If not then install them using

sudo yum install php56-xml php56-xmlrpc php56-soap php56-gd 

6) To list the other available php extensions

yum search php56 

7) PHP 5.6 MySQL extension (Assume you have already installed MySQL)

sudo yum install php56-mysqlnd 

(NOTE: it is not php56-mysql)

8) Start / Restart Apache

sudo service httpd start sudo service httpd restart 

9) Check the version

php -v httpd -v 

1 Comment

Are you using any special repositories? Having only default and EPEL 7 the Package php56 isn't available

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.