Centos5

如何在 CentOS 5 伺服器上安裝 PHP MCrypt + 庫 (libmcrypt)

  • March 19, 2013

我正在嘗試在我的伺服器上安裝 mCrypt for PHP,在此之前我發現我還需要安裝 libmcrypt …

不幸的是,我無法通過Google找到任何實際適用的說明。

我最初只是嘗試過yum install php-mcrypt,但我得到No package php-mcrypt available.了 - 所以我認為這是因為我還沒有安裝 libmcrypt?

謝謝!

回購清單:

$ yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.cogentco.com
* epel: mirror.cogentco.com
* extras: centos.aol.com
* rpmforge: fr2.rpmfind.net
* updates: mirror.ash.fastserv.com
repo id      repo name                                           status
base         CentOS-5 - Base                                     enabled:  3,535
epel         Extra Packages for Enterprise Linux 5 - x86_64      enabled:  6,642
extras       CentOS-5 - Extras                                   enabled:    299
rpmforge     RHEL 5 - RPMforge.net - dag                         enabled: 10,695
updates      CentOS-5 - Updates                                  enabled:    765
repolist: 21,936

我在這裡已經有點遠了..庫已成功安裝。mcrypt 雖然在依賴項上有一些錯誤:

Running Transaction
 Installing     : php-common                                               1/5 
warning: /etc/php.ini created as /etc/php.ini.rpmnew
 Installing     : php-cli                                                  2/5 
 Installing     : httpd                                                    3/5 
Error unpacking rpm package httpd-2.2.3-45.el5.centos.1.x86_64
warning: /etc/httpd/conf/httpd.conf created as /etc/httpd/conf/httpd.conf.rpmnew
warning: /etc/httpd/conf/magic created as /etc/httpd/conf/magic.rpmnew
error: unpacking of archive failed on file /etc/httpd/logs: cpio: rename
 Installing     : php                                                      4/5 
 Installing     : php-mcrypt                                               5/5 

Installed:
 php-mcrypt.x86_64 0:5.1.6-15.el5.centos.1                                     

Dependency Installed:
 php.x86_64 0:5.1.6-27.el5_5.3            php-cli.x86_64 0:5.1.6-27.el5_5.3    
 php-common.x86_64 0:5.1.6-27.el5_5.3    

Failed:
 httpd.x86_64 0:2.2.3-45.el5.centos.1                                          

Complete!

邁克的更新

[root@server ~]# fuser -k 80/tcp
80/tcp:              17496 17502 17503 17504 17505 17590
[root@server ~]# service httpd restart
httpd not running, trying to start
[root@server ~]# service httpd status

Looking up localhost
Making HTTP connection to localhost
Sending HTTP request.
HTTP request sent; waiting for response.
Alert!: Unexpected network read error; connection aborted.
Can't Access `http://localhost/whm-server-status'
Alert!: Unable to access document.

lynx: Can't access startfile 

此外,這是在 apache 錯誤日誌中:

[Sat Aug 20 16:59:33 2011] [error] (13)Permission denied: Cannot open SSLSessionCache DBM file `/usr/local/apache/logs/ssl_scache' for writing (store)

在我看來,您的 /etc/httpd/logs 不再是符號連結

ls -lsd /etc/httpd/logs

應該指出

/var/log/httpd

編輯

從您的評論看來,它不再是符號連結

mv /etc/httpd/logs /etc/httpd/logs.bak
ln -s /var/log/httpd /etc/httpd/logs
service httpd restart

然後嘗試 yum update

通過安裝這些 rpm 軟體包,您正在嚴重搞亂您的“cPanel”伺服器 apache + php。在cPanel中,你需要使用easyapache編譯apache & php來啟用額外的模組(easyapache腳本中的一切都很方便,你只需要選擇相應的包)。cPanel 為站點使用自定義 apache 和 php 建構,您需要以 cPanel 方式進行。我假設您刪除了 yum.conf 中的排除列表以實現這些安裝。要恢復您的伺服器,

  1. 解除安裝你安裝的 apache & php rpms。
  2. 執行 eachyapache 並選擇必要的模組,以使 apache 恢復活力。

您可以從命令行執行 easyapache 腳本(在螢幕上會很好)

**/scripts/easyapache**

或者可以使用WHM重新編譯你的apache + php。還要確保將排除列表放回 yum.conf 以防止再次發生這種情況。

exclude=apache* bind-chroot courier* dovecot* exim* filesystem httpd* mod_ssl* mysql* nsd* perl* php* proftpd* pure-ftpd* ruby* spamassassin* squirrelmail*

對於 EasyApache 文件:http ://docs.cpanel.net/twiki/bin/view/EasyApache3/

-$

引用自:https://serverfault.com/questions/303329