macOS Mojave更新后Apache无法正常工作 [英] Apache not working after macOS Mojave update

查看:157
本文介绍了macOS Mojave更新后Apache无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,将macOS从High Sierra更新到Mojave之后,使用PHP的Apache停止正常运行,所以我按照本指南的说明做了所有工作-

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'

推荐答案

在Mojave升级之前,PHP 5.6运行良好,因此我也遇到了类似的问题.我执行以下操作成功解决了该问题:

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:

  1. 运行以下命令 须藤nano/etc/apache2/httpd.conf

  1. Run the command below sudo nano /etc/apache2/httpd.conf

确保未注释以下模块:

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

  1. 为您检查正确的php模块(PHP 5.6 ot 7.x)并通过添加行或注释/取消注释行来加载所需的模块

  1. 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

OR

LoadModule php7_module libexec/apache2/libphp7.so

通过在行首添加#"来注释不需要的

Comment the one not needed by adding "#" to start of line

  1. 运行以下命令以重新启动apapche和进行测试 一种. sudo apachectl重新启动 b. apachectl configtest
  1. Run below commands for apapche restart and test a. sudo apachectl restart b. apachectl configtest

检查那里是否有错误

对于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):没有映像找到"

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆