Can't install PHP Package on CentOS

匿名 (未验证) 提交于 2019-12-03 02:30:02

问题:

I am having trouble re-installing PHP via yum on my server hosted by digital ocean.

I had PHP 5.4 installed but wanted 5.6. I added/enabled the remi repo's, ran yum -y remove php* and then tried to re-install php.

When I run yum -y install php I get the following:

Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile  * base: mirrors.centos.webair.com  * epel: mirrors.coreix.net  * extras: mirrors.centos.webair.com  * remi: remi.check-update.co.uk  * remi-php56: remi.check-update.co.uk  * updates: mirrors.centos.webair.com  * webtatic: uk.repo.webtatic.com Resolving Dependencies --> Running transaction check ---> Package php.x86_64 0:5.6.8-1.el6.remi will be installed --> Processing Dependency: php-common(x86-64) = 5.6.8-1.el6.remi for package: php-5.6.8-1.el6.remi.x86_64 --> Processing Dependency: php-cli(x86-64) = 5.6.8-1.el6.remi for package: php-5.6.8-1.el6.remi.x86_64 --> Processing Dependency: httpd-mmn = 20051115 for package: php-5.6.8-1.el6.remi.x86_64 --> Running transaction check ---> Package php.x86_64 0:5.6.8-1.el6.remi will be installed --> Processing Dependency: httpd-mmn = 20051115 for package: php-5.6.8-1.el6.remi.x86_64 ---> Package php-cli.x86_64 0:5.6.8-1.el6.remi will be installed ---> Package php-common.x86_64 0:5.6.8-1.el6.remi will be installed --> Processing Dependency: php-pecl-zip(x86-64) for package: php-common-5.6.8-1.el6.remi.x86_64 --> Processing Dependency: php-pecl-jsonc(x86-64) for package: php-common-5.6.8-1.el6.remi.x86_64 --> Running transaction check ---> Package php.x86_64 0:5.6.8-1.el6.remi will be installed --> Processing Dependency: httpd-mmn = 20051115 for package: php-5.6.8-1.el6.remi.x86_64 ---> Package php-pecl-jsonc.x86_64 0:1.3.7-1.el6.remi.5.6 will be installed ---> Package php-pecl-zip.x86_64 0:1.12.5-1.el6.remi.5.6 will be installed --> Finished Dependency Resolution Error: Package: php-5.6.8-1.el6.remi.x86_64 (remi-php56)            Requires: httpd-mmn = 20051115            Installed: httpd-2.4.6-31.el7.centos.x86_64 (@base)                httpd-mmn = 20120211                httpd-mmn = 20120211x8664                httpd-mmn = 20120211-x86-64  You could try using --skip-broken to work around the problem  You could try running: rpm -Va --nofiles --nodigest 

I have been following this tutorial

I'm a bit stuck. I have tried removing httpd, re-installing httpd, nothing seems to fix this. I even get the error when I disable remi and try and install PHP 5.4.

Any ideas on where to go from here?

I am running CentOS Linux release 7.1.1503 (Core)

回答1:

I fixed it! The issue was that I had the wrong version of EL installed. I removed all my extra repo's, removed all php packages, removed httpd. Ran the following:

yum install epel-release rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm yum clean yum update 

I was then able to install PHP using the following

yum install php56w php56w-opcache php56w-mcrypt php56w-pdo php56w-mysql 


回答2:

I also encountered the same problem while installing php70w(webstatic) on my linux machine. The following command helped me to install php70

sudo yum clean all   // to clear all caches 

after clearing cache again install php70 using:

sudo yum install php70 


回答3:

Though this probably suits serverfault or poweruser better, I will still answer.

This is based from experience and works every single time if done as instructed.

To install, first you must add the Webtatic EL yum repository information corresponding to your CentOS/RHEL version to yum:

CentOS/RHEL 7.x:

rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm 

Then you can install each of your individual packages like this:

yum install php56w-<package name> 

Don't forget the php56w prefix though.

Source: https://webtatic.com/packages/php56/


Try this (in regards to the comments):

yum update -y; yum remove httpd && yum install httpd; yum install php56w-common php56w-opcache php56w-mysql 


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!