Laravel 和使用 PHP 和 PDO 的 Brew 安装

Laravel and Brew installation with PHP and PDO

我刚从 linux 迁移到 mac,在安装 PHP 和 Laravel 的正确驱动程序时遇到了一些问题。

我运行brew install homebrew/php/php56-mysqlnd_ms

但现在我不断收到此错误

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/opt/php56-mcrypt/mcrypt.so' - dlopen(/usr/local/opt/php56-mcrypt/mcrypt.so, 9): image not found in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library '/usr/local/opt/php56-mcrypt/mcrypt.so' - dlopen(/usr/local/opt/php56-mcrypt/mcrypt.so, 9): image not found in Unknown on line 0
phpinfo()

PHP Version => 5.6.21

有人知道如何解决这个错误吗?我很茫然

看来你必须安装php的模块mcrypt。

brew update
brew upgrade
brew tap homebrew/dupes
brew tap josegonzalez/homebrew-php
brew install php54-mcrypt
sudo composer update

另外一点,如果你想使用 mac 和 linux,你可以使用 Vagrant,它与 virtualbox + vagrant 的工作方式非常好,你可以在其他 OS 上使用堆栈.

https://www.vagrantup.com/

这是一个很好的 vagrant 项目,可以安装你需要的所有技术。

https://github.com/fideloper/Vaprobash

您缺少 mcrypt 。你可以试试,

brew install php54-mcrypt --without-homebrew-php

然后,在/etc/php.ini中添加

extension="/usr/local/Cellar/php54-mcrypt/5.4.24/mcrypt.so"

希望对您有所帮助,请告诉我们