[PHP] 成功安裝mcrypt.so的辦法


1. php沒有mcrypt.so→ 在Mac下brew安裝php後,如何新增擴充套件?

#pecl安裝擴充套件
#檢視pecl
pecl version

#安裝擴充套件
pecl install mcrypt

2. 安裝mcrypt.so失敗→ 回報mcrypt.h not found的解決辦法

#configure: error: mcrypt.h not found. Please reinstall libmcrypt. 使用 php mcrypt 前必須先安裝libmcrypt
#libmcrypt原始碼安裝方法:使用wget可以通過以下路徑下載 
wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/attic/libmcrypt/libmcrypt-2.5.7.tar.gz

#解壓
tar -zxvf libmcrypt-2.5.7.tar.gz 

#進入目錄
cd libmcrypt-2.5.7

#編譯(預設安裝到/usr/local/lib/)
./configure --prefix=/usr/local/libmcrypt

#執行安裝
make && make install

3. 安裝libmcrypt失敗→ 如何安裝wget?

#zsh: command not found: wget
brew install wget

4. 安裝mcrypt.so失敗→ Warning: mkdir(): File exists in System.php on line 294

Warning: mkdir(): File exists in System.php on line 294
PHP Warning:  mkdir(): File exists in /usr/local/Cellar/php@7.3/7.3.12/share/php@7.3/pear/System.php on line 294

Warning: mkdir(): File exists in /usr/local/Cellar/php@7.3/7.3.12/share/php@7.3/pear/System.php on line 294
ERROR: failed to mkdir /usr/local/Cellar/php@7.3/7.3.12/pecl/20180731

#解决方案:在命令行下面使用此命令
mkdir -p /usr/local/lib/php/pecl

5. php.ini如果有變更的話,請重新啟動Apache伺服器


Source

【env】mac下brew安裝php及擴充套件(新)
PHP安裝mcrypt.so報錯 mcrypt.h not found 的解決辦法
編譯安裝php報錯PHP configure: error: mcrypt.h not found. Please reinstall libmcrypt. 解決辦法
mac 下安裝php7全過程介紹
How to install wget in macOS?
How to Install and Use wget on Mac
PHP 7.3.8安裝ext-Redis擴展報錯處理方案

沒有留言:

技術提供:Blogger.