簡體   English   中英

centOS 7 無法安裝 php-mbstring 擴展

[英]centOS 7 Can't install php-mbstring extension

我嘗試安裝擴展 mbstring,但出現以下錯誤:

    Error: Package: php-mbstring-5.4.16-23.el7_0.3.x86_64 (updates)
        Requires: php-common(x86-64) = 5.4.16-23.el7_0.3
        Installed: php-common-5.4.38-1.el7.remi.x86_64 (@remi)
        php-common(x86-64) = 5.4.38-1.el7.remi
        Available: php-common-5.4.16-21.el7.x86_64 (base)
        php-common(x86-64) = 5.4.16-21.el7
        Available: php-common-5.4.16-23.el7_0.x86_64 (updates)
        php-common(x86-64) = 5.4.16-23.el7_0
        Available: php-common-5.4.16-23.el7_0.1.x86_64 (updates)
        php-common(x86-64) = 5.4.16-23.el7_0.1
        Available: php-common-5.4.16-23.el7_0.3.x86_64 (updates)
        php-common(x86-64) = 5.4.16-23.el7_0.3
    You could try using --skip-broken to work around the problem
    You could try running: rpm -Va --nofiles --nodigest

我能做些什么來解決這個問題?

謝謝你的幫助

對於想知道如何解決這個問題的人:

sudo yum remove php-common

然后你可以:

sudo yum install php-mbstring

它將自動安裝依賴項(php-common)

這個來自 AWS Amazon 論壇的回答:

yum -y install yum-utils
yum repolist all
yum-config-manager --enable rhui-REGION-rhel-server-extras rhui-REGION-rhel-server-optional

然后你可以安裝php-mbstring ,也許,我不知道確切,但也許它只對亞馬遜上的服務器有幫助。

所選答案可能會更改已安裝的 PHP 版本。 當不使用 CentOS PHP 時, yum會嘗試為錯誤版本的 PHP 安裝mbstring擴展。

您可以檢查安裝PHP版本php -v

$ php -v
PHP 5.5.36 (cli) (built: May 28 2016 12:05:32)

然后繼續為安裝的 PHP 版本安裝正確的mbstring版本:

$ sudo yum install php55w-mbstring

您必須指定與 php-common 相同的版本,我的是 php70w-common

 sudo yum install php70w-mbstring

以上不適用於 Godaddy 專用服務器 centOS 6、apache 2.4、php 5.6

相反,你應該

使用 EasyApache 安裝 mbstring PHP 擴展

檢查你是否已經擁有它,膩子或 ssh

php -m | grep 字符串

[如果沒有,意味着缺少 mbstring]

現在你需要轉到godaddy你的賬戶頁面,

單擊管理器服務器,

打開 whm ----- 搜索 apache,

打開“easy apache 4”(我的情況)

現在您需要自定義當前安裝的軟件包,

經過

單擊“當前安裝的軟件包...”旁邊頂行的“自定義”按鈕

搜索 mbstring,

單擊它旁邊的開/關切換。

單擊下一步,下一步,.... 優先權.. 完成。

現在你應該有 mbstring

通過在膩子(ssh)再次檢查

php -m | grep mbstring [應該看到mbstring]

或者你可以在 phpinfo() 頁面找到 mbstring

需要搜索您需要哪個 mbstring 版本。

cat /etc/redhat-release && php -v && yum search mbstring



========================================================================= N/S matched: mbstring ==========================================================================
ea-php54-php-mbstring.x86_64 : A module for PHP applications which need multi-byte string handling
ea-php55-php-mbstring.x86_64 : A module for PHP applications which need multi-byte string handling
ea-php56-php-mbstring.x86_64 : A module for PHP applications which need multi-byte string handling
ea-php70-php-mbstring.x86_64 : A module for PHP applications which need multi-byte string handling
ea-php71-php-mbstring.x86_64 : A module for PHP applications which need multi-byte string handling
ea-php72-php-mbstring.x86_64 : A module for PHP applications which need multi-byte string handling
ea-php73-php-mbstring.x86_64 : A module for PHP applications which need multi-byte string handling

現在您可以像我使用 php7.1 一樣檢查您實際需要的內容,因此我的命令將是

sudo yum install ea-php71-php-mbstring

找了半天的答案,才發現 cPanel / WHM 版本的 CentOS 會禁用 YUM 更新 php。 您應該從/etc/yum.conf排除列表中刪除php*

....

以上不適用於 Godaddy 專用服務器 centOS 6、apache 2.4、php 5.6

相反,您應該安裝帶有 EasyApache 檢查的 mbstring PHP 擴展,如果您已經通過 putty 或 ssh

php -m | grep mbstring       [if nothing, means missing mbstring]

現在你需要去godaddy你的賬戶頁面,

1.click manager server,

2.open whm ----- search for apache,

3.open "easy apache 4"(my case)

現在您需要自定義當前安裝的軟件包,通過

4.click "customize" button on top line next to "currently installed package..."

5.In the search bar write "mbstring",

6.click on/off toggle next to it.

7.click next, next, .... privision..done.

現在你應該通過在 putty(ssh) 處再次檢查來獲得 mbstring

php -m | grep mbstring         [should see mbstring]

或者你可以在 phpinfo() 頁面找到 mbstring

謝謝,我的問題解決了

Fedora 28(雲版)

sudo yum install php56-php-mbstring
sudo yum install php70-php-mbstring
sudo yum install php71-php-mbstring
sudo yum install php72-php-mbstring
sudo yum install php73-php-mbstring

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM