Apache and php in a mac mini 2023 M2 sonoma

Hello,


I'm traying to install php with homebrew for making a web server with my new mac mini.

Apache works. / displays “it works”.


I installed php via homebrew, configured httpd.conf as requested, and added these lines :


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

<FilesMatch \.php$>

SetHandler application/x-httpd-php

</FilesMatch>


Even a simple file containing


<?php

phpinfo();

?>


sends an error message to the browser :


This site is inaccessible

localhost does not allow connection

(I translate from French)


It seems to have a problem related to code signature issues:


sudo apachectl configtest


[Thu Aug 29 23:28:51.761272 2024] [so:error] [pid 8361] AH06665: No code signing authority for module at /opt/homebrew/opt/php/lib/httpd/modules/libphp.so specified in LoadModule directive.

httpd: Syntax error on line 72 of /private/etc/apache2/httpd.conf: Code signing absent - not loading module at: /opt/homebrew/opt/php/lib/httpd/modules/libphp.so


However, php seems correct:


codesign -vv /opt/homebrew/opt/php/lib/httpd/modules/libphp.so


/opt/homebrew/opt/php/lib/httpd/modules/libphp.so: valid on disk

/opt/homebrew/opt/php/lib/httpd/modules/libphp.so: satisfies its Designated Requirement


I'm not a specialist, I'm trying to follow the information I find to make the web server, but I've been totally blocked for hours. If anyone could help me I would be deeply grateful. Merci !


VRC


[Edited by Moderator]

Mac mini, macOS 14.4

Posted on Aug 29, 2024 4:55 PM

Reply
2 replies

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Apache and php in a mac mini 2023 M2 sonoma

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.