php-macOS Mojave更新后Apache无法正常工作
作者:互联网
好的,将macOS从High Sierra更新到Mojave之后,带有PHP的Apache停止正常运行,所以我按照指南中的说明做了所有工作-https://getgrav.org/blog/macos-mojave-apache-multiple-php-versions
但是在那之后,Apache仍然无法正常运行,有时可以正常运行,有时不能正常运行,并且在浏览器ERR_CONNECTION_REFUSED或其他类似404或500的错误中显示.
在Apache日志中是:
[Tue Oct 02 15:02:23.209423 2018] [mpm_prefork:notice] [pid 14579] AH00173: SIGHUP received. Attempting to restart
[Tue Oct 02 15:02:23.255957 2018] [mpm_prefork:notice] [pid 14579] AH00163: Apache/2.4.35 (Unix) PHP/7.2.10 configured -- resuming normal operations
[Tue Oct 02 15:02:23.256008 2018] [core:notice] [pid 14579] AH00094: Command line: '/usr/local/opt/httpd/bin/httpd'
[Tue Oct 02 15:14:37.626645 2018] [mpm_prefork:notice] [pid 14579] AH00173: SIGHUP received. Attempting to restart
[Tue Oct 02 15:14:37.674603 2018] [mpm_prefork:notice] [pid 14579] AH00163: Apache/2.4.35 (Unix) PHP/7.2.10 configured -- resuming normal operations
[Tue Oct 02 15:14:37.674672 2018] [core:notice] [pid 14579] AH00094: Command line: '/usr/local/opt/httpd/bin/httpd'
[Tue Oct 02 15:28:40.715060 2018] [mpm_prefork:notice] [pid 14579] AH00173: SIGHUP received. Attempting to restart
[Tue Oct 02 15:28:40.752117 2018] [ssl:warn] [pid 14579] AH01909: www.example.com:8443:0 server certificate does NOT include an ID which matches the server name
[Tue Oct 02 15:28:40.766009 2018] [mpm_prefork:notice] [pid 14579] AH00163: Apache/2.4.35 (Unix) OpenSSL/1.0.2p PHP/7.2.10 configured -- resuming normal operations
[Tue Oct 02 15:28:40.766052 2018] [core:notice] [pid 14579] AH00094: Command line: '/usr/local/opt/httpd/bin/httpd'
解决方法:
我在PHP 5.6上也遇到过类似的问题,因为它在Mojave升级之前运行良好.我执行以下操作成功解决了该问题:
>运行以下命令
须藤nano /etc/apache2/httpd.conf
>确保未注释以下模块:
LoadModule authz_core_module libexec / apache2 / mod_authz_core.so
LoadModule authz_host_module libexec / apache2 / mod_authz_host.so
LoadModule userdir_module libexec / apache2 / mod_userdir.so
LoadModule include_module libexec / apache2 / mod_include.so
LoadModule rewrite_module libexec / apache2 / mod_rewrite.so
我在httpd.conf中添加了缺失的一个
>为您检查正确的php模块(PHP 5.6 ot 7.x),并通过添加行或注释/取消注释行来加载所需的模块
LoadModule php5_module libexec / apache2 / libphp5.so
要么
LoadModule php7_module libexec/apache2/libphp7.so
通过在行首添加“#”来注释不需要的注释
>在以下命令中运行以重新启动apapche和进行测试
一种. sudo apachectl重新启动
湾apachectl配置测试
检查那里是否有错误
对于PHP 5.6:
如果您在upgarde之前已经在系统中安装了带有brew的php 5,并且上述更改给出了如下错误
“ httpd:/private/etc/apache2/httpd.conf的第180行的语法错误:无法将libexec / apache2 / libphp5.so加载到服务器中:dlopen(/usr/libexec/apache2/libphp5.so,10):没有映像发现”
然后在系统中搜索libphp5.so,如果找到,则将其复制到“ /usr/libexec / apache2 /”
就我而言,命令是
sudo cp ./local/Cellar/php@5.6/5.6.25_1/libexec/apache2/libphp5.so /usr/libexec/apache2/
所有这些都使事情在我的系统中正常工作
标签:php,macos,apache,apache2,macos-mojave 来源: https://codeday.me/bug/20191010/1887870.html