我只是将其更新为Mac OS X Mojave。我的本地站点现在停止加载。
我不断得到
需要Mcrypt PHP扩展名。
我尝试了
brew update
brew upgrade
brew tap homebrew/dupes
brew tap josegonzalez/homebrew-php
brew install php54-mcrypt
php --version // To Test your php
我知道了
错误:php54-mcrypt:无法加载此类文件-/ usr / local / opt / php54-mcrypt / Abstract / abstract-php-extension
我尝试重新加载我的网站
我还是得到这个
需要Mcrypt PHP扩展名。
我的设置详细信息
php --version ,我得到
PHP 7.1.4 (cli) (built: May 6 2017 10:02:00) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.1.4, Copyright (c) 1999-2017, by Zend Technologies
哪个php ,我
/usr/local/php5/bin/php
php -i | grep php.ini ,我得到
Configuration File (php.ini) Path => /usr/local/php5/lib
Loaded Configuration File => /usr/local/php5/lib/php.ini
printenv ,我知道了
TERM=xterm-256color
SHELL=/bin/bash
CLICOLOR=1
TMPDIR=/var/folders/54/y_678c6n7q7_pgk1v5lkzwnr0000gp/T/
SSH_CLIENT=10.20.100.88 49732 22
OLDPWD=/Users/bheng
SSH_TTY=/dev/ttys016
USER=bheng
LSCOLORS=ExFxBxDxCxegedabagacad
MAIL=/var/mail/bheng
PATH=/Library/Frameworks/Python.framework/Versions/3.6/bin:/usr/local/opt/curl/bin:/Applications/Postgres.app/Contents/Versions/latest/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/sbin:/usr/local/php5/bin:/Users/bheng/.composer/vendor/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/pgsql/bin:/opt/X11/bin:/Applications/Wireshark.app/Contents/MacOS:/usr/local/mysql/bin
PWD=/Users/bheng/Desktop
SHLVL=1
HOME=/Users/bheng
GREP_OPTIONS=--color=always
LOGNAME=bheng
如何进一步调试呢?
SSH_CONNECTION=10.20.100.88 49732 10.20.100.88 22
_=/usr/bin/printenv
当我打开php.info时,我看到了
答案 0 :(得分:1)
Homebrew最近对PHP及其扩展进行了一些更改。在您必须点击homebrew/php
并使用brew install php71
安装特定的PHP版本以及使用brew install php71-mcrypt
安装一个模块之前。现在,您必须使用php@7.1并使用PECL自己构建扩展。
由于您有许多不同的PHP版本,因此建议您全部删除。以下步骤将从您的系统中删除所有旧的PHP版本:
# Will show you any php packages you've got. make not of that!
brew list | grep php
# Will uninstall any php packages you may have
brew list | grep php | while read x; do brew uninstall --force $x; done
# You may need to run this too
rm -rf /usr/local/Cellar/php
# Clean up Launch Agents
rm ~/Library/LaunchAgents/homebrew.mxcl.php*
sudo rm /Library/LaunchDaemons/homebrew.mxcl.php*
brew untap homebrew/php
brew cleanup
brew update
brew doctor # just to make sure you're all clean
ps ax | grep php
# if some PHP daemons are still runing, reboot.
重新启动后,您可以使用新方法安装PHP:
brew install php // This installs the latest version. If you need PHP7.1 use brew install php@7.1
检查是否可行:
php --version
以下重要路径是:
要安装扩展,您必须使用pecl:
pecl install mcrypt // Install all other extensions this way
扩展名将安装到/usr/local/lib/php/pecl/20170718/
。
如果使用Apache,则必须加载Apache模块。编辑/usr/local/etc/httpd/httpd.conf
并搜索所有模块已加载的部分。在本节末尾添加以下行:
LoadModule php7_module /usr/local/opt/php@7.2/lib/httpd/modules/libphp7.so
重新启动Apache服务器,并检查是否使用了正确的PHP版本。