PHP 7 conflicts with PHP 5 (Centos 7)

15,416

Solution 1

You can install php7 for C7 (and others) as a Software Collection (scl) This installs alongside the system provided php 5 and is entirely independent of it. You can find the php7 scl on the REMI repo. You may also be interested in this Q&A on SF.

Solution 2

You can run the following command

yum --skip-broken install (package_name)

It will install all the dependencies and skip conflicting packages.

Solution 3

I don't think that is the good way. It is very ornate to configuration and to program if you have to different PHP versions on one server. It's much easier if you have a separate server. Also why do you need both? PHP 5 app are pretty much compatible to PHP 7... if they use mysql_connect instead of mysqli

Share:
15,416

Related videos on Youtube

Wesley
Author by

Wesley

Updated on September 18, 2022

Comments

  • Wesley
    Wesley over 1 year

    Trying to install PHP 7 now that it's available;

    (on centos 7)

    added repo's:

    rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
    rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
    Then installed via:
    
    yum install php70w php70w-opcache
    

    Output is:

    [root@host]# yum install php70w php70w-opcache
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
    * base: mirrors.advancedhosters.com
    * epel: mirror.symnds.com
    * extras: mirror.netdepot.com
    * updates: mirrors.rit.edu
    * webtatic: us-east.repo.webtatic.com
    Resolving Dependencies
    --> Running transaction check
    ---> Package php70w.x86_64 0:7.0.2-1.w7 will be installed
    --> Processing Dependency: php70w-common(x86-64) = 7.0.2-1.w7 for package: php70w-7.0.2-1.w7.x86_64
    --> Processing Dependency: php70w-cli(x86-64) = 7.0.2-1.w7 for package: php70w-7.0.2-1.w7.x86_64
    --> Processing Dependency: php70w-cli = 7.0.2-1.w7 for package: php70w-7.0.2-1.w7.x86_64
    ---> Package php70w-opcache.x86_64 0:7.0.2-1.w7 will be installed
    --> Running transaction check
    ---> Package php70w-cli.x86_64 0:7.0.2-1.w7 will be installed
    ---> Package php70w-common.x86_64 0:7.0.2-1.w7 will be installed
    --> Processing Conflict: php70w-common-7.0.2-1.w7.x86_64 conflicts php-common < 5.5.0
    --> Finished Dependency Resolution
    Error: php70w-common conflicts with php-common-5.4.16-36.el7_1.x86_64
    You could try using --skip-broken to work around the problem
    You could try running: rpm -Va --nofiles --nodigest
    

    So the problem is : Error: php70w-common conflicts with php-common-5.4.16-36.el7_1.x86_64

    How to fix this? I need both versions running simultaneously.

  • Remi Collet
    Remi Collet over 8 years
    See the configuration Wizard on rpms.remirepo.net/wizard
  • Remi Collet
    Remi Collet over 8 years
    I must disagree. Running various versions on the same box is very useful. Especially to test app before upgrading prod. And this is very easy using various FPM instance.