Apache not working after macOS Mojave update

后端 未结 5 1365
野趣味
野趣味 2020-12-20 14:23

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-mojav

相关标签:
5条回答
  • 2020-12-20 14:51

    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. Run the command below sudo nano /etc/apache2/httpd.conf

    2. make sure the below modules are uncommented:

      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

    I have added the missing one in httpd.conf

    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

    OR

    LoadModule php7_module libexec/apache2/libphp7.so
    

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

    1. Run below commands for apapche restart and test a. sudo apachectl restart b. apachectl configtest

    Check for any errors there

    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"

    Then search for libphp5.so in the system and if found copy it to "/usr/libexec/apache2/"

    In my case command was

    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

    0 讨论(0)
  • 2020-12-20 14:53

    because the topic is the httpd.conf messed up after Mojave upgrade I got also this error during sudo apachectl configtest

    Could not reliably determine the server's fully qualified domain name, using XXX. Set the 'ServerName' directive globally to suppress this message
    

    I found out the #ServerName localhost:80 in the httpd.conf was comented out, uncommenting resolved my issue.

    0 讨论(0)
  • 2020-12-20 14:56

    I followed the instructions in the above answers and still got a 403 Forbidden when trying to access my /Users/myuser/Sites/ folder. To fix this I had to change the user in /etc/apache2/httpd.conf from _www to my own user.

    To do this edit your httpd.conf file using your favorite editor /etc/apache2/httpd.conf. Look for:

    User _www
    

    replace with your user:

    User myuser
    

    then restart apache:

    sudo apachectl restart
    
    0 讨论(0)
  • 2020-12-20 15:08

    Further to adang's reply i also had to uncomment this line:

    Include /private/etc/apache2/extra/httpd-userdir.conf
    

    in order for it to know what user directories were available.

    Within /private/etc/apache2/extra/httpd-userdir.conf

    I had to uncomment this line:

    Include /private/etc/apache2/users/*.conf
    

    then:

    sudo apachectl restart
    
    0 讨论(0)
  • 2020-12-20 15:14

    I had the same issue after installing the Mac OS Mojave. I have done the following steps and it worked with me:

    brew update 
    

    then:

    brew upgrade
    

    I have edited /etc/apache2/httpd.conf by uncommenting the following line:

    LoadModule php7_module libexec/apache2/libphp7.so
    

    Open the terminal and restart the apache server:

    sudo apachectl restart
    

    you might find the post on this link helpful

    0 讨论(0)
提交回复
热议问题