2024年6月9日日曜日

Macでなぜか Apache が動かなくなったので brew install httpd した

 Apache が動かなくなった (MacOS 13.6.7)

/var/log/apache2/access_log も error_log も出力されなくなっている


$ sudo apachectl start  すると以下のようなエラーとなった。


Load failed: 5: Input/output error

Try running `launchctl bootstrap` as root for richer errors.


いろいろ試したがなかなかうまくいかないので brew install httpd することにした。


$ brew install httpd                            

                                                                  
To have launchd start httpd now and restart at login:             

  brew services start httpd                                       

Or, if you don't want/need a background service you can just run: 

  apachectl start                                                 



サービス起動停止

brew services start httpd

brew services stop httpd

brew services restart httpd


起動停止 

apachectl start 

apachectl stop


設定ファイル /opt/homebrew/etc/httpd/httpd.conf


Listen 80 # 8080 から変更


ServerName Mac-mini.local:80 # apachectl start で必要


<FilesMatch \.php$>

 SetHandler application/x-httpd-php

</FilesMatch> 


#LoadModule php_module /opt/homebrew/opt/php/lib/httpd/modules/libphp.so "myCA"

LoadModule php_module /opt/homebrew/opt/php/lib/httpd/modules/libphp.so



php は前回 brew install php した。そのとき署名が要求されたが、今回は不要("myCA"ありだと動かなかった)だった。


参考

https://weblabo.oscasierra.net/apache-macos-install-homebrew/

Macでなぜか Apache が動かなくなったので brew install httpd した

 Apache が動かなくなった (MacOS 13.6.7) /var/log/apache2/access_log も error_log も出力されなくなっている $ sudo apachectl start  すると以下のようなエラーとなった。 Load failed: ...