如何解决 Homebrew openssl 冲突?

How can I resolve Homebrew openssl conflicts?

我正在使用 High Sierra 10.13.6,最近 运行 我的本地开发工作的 Homebrew 环境出现问题。我似乎无法弄清楚问题出在哪里。任何 Composer 或 Drush 命令都会给出这个

dyld: Library not loaded: /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib
  Referenced from: /usr/local/bin/php
  Reason: image not found
Abort trap: 6

我重新启动了我的电脑,当我尝试启动 apachectl 时;我得到

httpd: Syntax error on line 179 of /usr/local/etc/httpd/httpd.conf: Cannot load /usr/local/Cellar/php71/7.1.12_23/libexec/apache2/libphp7.so into server: dlopen(/usr/local/Cellar/php71/7.1.12_23/libexec/apache2/libphp7.so, 10): Library not loaded: /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib\n  Referenced from: /usr/local/Cellar/php71/7.1.12_23/libexec/apache2/libphp7.so\n  Reason: image not found

我认为这是因为路径正在寻找 openssl,但是在 Brew 列表中,我没有 openssl,现在是 openssl@1.1

Bash 配置文件具有以下内容:

export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"

$which openssl returns

/usr/local/opt/openssl@1.1/bin/openssl

我该怎么做才能解决这个问题?也许我错过了显而易见的东西。

所以万一有人遇到这个。我自己设法解决了这个问题。

首先,我在 usr/local/etc/httpd/httpd.conf 文件中注释掉了以下行

LoadModule php7_module        /usr/local/Cellar/php71/7.1.12_23/libexec/apache2/libphp7.so

下一个我运行

$brew install php@7.3

我在 .bash_profile

中添加了以下行
export PATH="/usr/local/opt/php@7.3/bin:$PATH"
export PATH="/usr/local/opt/php@7.3/sbin:$PATH"

然后将以下行添加到 usr/local/etc/httpd/httpd.conf 文件

LoadModule php7_module         /usr/local/Cellar/php@7.3/7.3.13/lib/httpd/modules/libphp7.so

然后我重启了电脑然后运行

$brew services start php@7.3
$brew services restart httpd
$sudo apachectl -k restart 

然后我遇到了一些 sql 连接问题。

$brew upgrade mariadb 
$brew services restart mariadb
$brew services restart httpd
$sudo apachectl -k restart 

一切都在一起了。希望这有帮助。

如果这对不愿意重新安装的其他人有帮助PHP:

ln -s /usr/local/Cellar/openssl/1.0.2s/lib/libcrypto.1.0.0.dylib /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib
ln -s /usr/local/Cellar/openssl/1.0.2s/lib/libssl.1.0.0.dylib /usr/local/opt/openssl/lib/libssl.1.0.0.dylib