macOS Mojave 更新后 Apache 无法正常工作 [英] Apache not working after macOS Mojave update
问题描述
好的,在将 macOS 从 High Sierra 更新到 Mojave 后,使用 PHP 的 Apache 停止正常工作,所以我按照本指南中的说明做了一切 - https://getgrav.org/blog/macos-mojave-apache-multiple-php-versions
Ok, after update macOS from High Sierra to Mojave, Apache with PHP stop working properly, so I did everything as is said in this guide - https://getgrav.org/blog/macos-mojave-apache-multiple-php-versions
但在那之后,apache 仍然无法正常工作,有时工作,有时不工作,并且在浏览器中显示 ERR_CONNECTION_REFUSED 或其他错误,如 404 或 500.
but after that, still apache not working properly, sometimes working, sometimes not, and its says in browsers ERR_CONNECTION_REFUSED or other errors like 404 or 500.
在apache日志中是:
In apache log is:
[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 升级之前运行良好.我执行了以下操作以成功解决问题:
I have faced similar issue with PHP 5.6 as it was running fine before Mojave upgrade. I did the following to resolve the issue successfully:
运行下面的命令须藤纳米/etc/apache2/httpd.conf
Run the command below sudo nano /etc/apache2/httpd.conf
确保取消对以下模块的注释:
make sure the below modules are uncommented:
LoadModule authz_core_module libexec/apache2/mod_authz_core.so
LoadModule authz_core_module libexec/apache2/mod_authz_core.so
LoadModule authz_host_module libexec/apache2/mod_authz_host.so
LoadModule authz_host_module libexec/apache2/mod_authz_host.so
LoadModule userdir_module libexec/apache2/mod_userdir.so
LoadModule userdir_module libexec/apache2/mod_userdir.so
LoadModule include_module libexec/apache2/mod_include.so
LoadModule include_module libexec/apache2/mod_include.so
LoadModule rewrite_module libexec/apache2/mod_rewrite.so
LoadModule rewrite_module libexec/apache2/mod_rewrite.so
我在 httpd.conf 中添加了缺失的一个
I have added the missing one in httpd.conf
检查适合您的 php 模块(PHP 5.6 或 7.x)并通过添加行或注释/取消注释行来加载所需的模块
Check the right php module for you (PHP 5.6 ot 7.x) and load the required module too by adding the line or commenting/uncommenting the lines
LoadModule php5_module libexec/apache2/libphp5.so
LoadModule php5_module libexec/apache2/libphp5.so
或
LoadModule php7_module libexec/apache2/libphp7.so
在行首添加#"来注释不需要的
Comment the one not needed by adding "#" to start of line
- 运行下面的命令来重启和测试一种.须藤apachectl重启湾apachectl 配置测试
检查那里是否有任何错误
Check for any errors there
对于 PHP 5.6:如果您在升级之前已经在系统中使用了带有 brew 的 php 5 并且上述更改会给出如下错误httpd:/private/etc/apache2/httpd.conf 的第 180 行的语法错误:无法将 libexec/apache2/libphp5.so 加载到服务器中:dlopen(/usr/libexec/apache2/libphp5.so, 10): image not找到"
For PHP 5.6: In case you were having the php 5 with brew already in system before upgarde and the above changes gives error as below "httpd: Syntax error on line 180 of /private/etc/apache2/httpd.conf: Cannot load libexec/apache2/libphp5.so into server: dlopen(/usr/libexec/apache2/libphp5.so, 10): image not found"
然后在系统中搜索libphp5.so,找到后复制到"/usr/libexec/apache2/"
Then search for libphp5.so in the system and if found copy it to "/usr/libexec/apache2/"
就我而言,命令是
sudo cp ./local/Cellar/php@5.6/5.6.25_1/libexec/apache2/libphp5.so /usr/libexec/apache2/
这一切都使我的系统能够正常工作
This all made things working in my system
这篇关于macOS Mojave 更新后 Apache 无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!