简体   繁体   English

Centos6上的PHP安装冲突

[英]PHP installation conflicts on Centos6

I'm new to server and linux and I ran into some problems. 我是服务器和Linux的新手,我遇到了一些问题。 I'm trying to update my PHP by looking for linux commands through the net. 我正在尝试通过网络查找linux命令来更新我的PHP。 Some commands ran perfectly but some not. 有些命令运行完美但有些命令没有。

I tried using this command to install php-gd since I have this error message 'Required GD library is missing'. 我尝试使用此命令来安装php-gd,因为我有此错误消息“必需的GD库丢失”。 So, I tried to run this below: 所以,我试着在下面运行:

yum install php-gd

However, it give me this error message below: 但是,它给出了以下错误消息:

php56w-common conflicts with php-common-5.3.3-46.el6_6.x86_64

Here are some info on my server: 以下是我服务器上的一些信息:

[root@uat ~]# rpm -ql php
package php is not installed

[root@uat ~]# rpm -qa php\*
php56w-pdo-5.6.11-1.w6.x86_64
php56w-5.6.11-1.w6.x86_64
php56w-cli-5.6.11-1.w6.x86_64
php56w-common-5.6.11-1.w6.x86_64
php56w-mysql-5.6.11-1.w6.x86_64

[root@uat ~]# rpm -Va php\*
S.5....T.  c /etc/php.ini
[root@uat ~]# which php
/usr/bin/php

[root@uat ~]# php -v
PHP 5.6.11 (cli) (built: Jul 10 2015 22:43:20)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies

Do you know what have I done wrong upgrading my php? 你知道我在升级我的php时做错了什么吗? Should I remove all php files on my server and reinstall? 我应该删除服务器上的所有php文件并重新安装吗? How? 怎么样?

Solved it by removing all php using "yum remove php php-common" 通过使用“yum remove php php-common”删除所有php解决它

and modified the filename "remi.repo" under the folder /etc/yum.repos.d like below: 并在文件夹/etc/yum.repos.d下修改了文件名“remi.repo”,如下所示:

[remi-php56]
name=Remi's PHP 5.6 RPM repository for Enterprise Linux 6 - $basearch
#baseurl=http://rpms.remirepo.net/enterprise/6/php56/$basearch/
mirrorlist=http://rpms.remirepo.net/enterprise/6/php56/mirror
# WARNING: If you enable this repository, you must also enable "remi"
enabled=1
gpgcheck=1

making sure that php56 is enabled=1. 确保启用php56 = 1。

Go to /etc/yum.repos.d. 转到/etc/yum.repos.d。 Remove the extra repository that you can see in your complete error message. 删除您可以在完整错误消息中看到的额外存储库。 Nima 尼玛

If you are using Centos 6.7 and have php 5.6 installed, the following command worked for me: 如果您使用的是Centos 6.7并安装了php 5.6,则以下命令对我有用:

sudo yum install php56w-pecl-xdebug.x86_64 (I was installing xdebug, not GD) sudo yum install php56w-pecl-xdebug.x86_64 (我正在安装xdebug,而不是GD)

I found this by running yum search php56 我通过运行yum search php56找到了这个

You should run: 你应该运行:

yum install php56w-gd

So when install php-extension have error: 所以当安装php-extension有错误时:

*-common conflicts with php-common-5.3.3-46.el6_6.x86_64

Just type *-extension 只需输入*-extension

Example: 例:

yum install php-fpm have error yum install php-fpm有错误

Error: php56u-common conflicts with php-common-5.3.3-46.el6_7.1.x86_64

then you should run 然后你应该跑

yum install php56u-fpm

The reason of this error is you install a php version don't match the system repo version. 出现此错误的原因是您安装的php版本与系统repo版本不匹配。 So yum get a version of the system repo, but this don't compatible with the php version you have installed. 因此,yum获得了系统仓库的版本,但这与您安装的php版本不兼容。 When you specific the php version, yum get the right version, so happy! 当你具体的php版本时,yum得到了正确的版本,真高兴!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM