I just updated from PHP7 to PHP8. Now my Apache2 is going crazy. The server is or not accessible, or shows my PHP as plain text.
php -v
iel@MacBook-Pro-van-Niel apache2 % php -v
PHP 8.0.12 (cli) (built: Oct 21 2021 14:38:26) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.12, Copyright (c) Zend Technologies
with Zend OPcache v8.0.12, Copyright (c), by Zend Technologies
cat /var/log/apache2/error_log
...
AH00112: Warning: DocumentRoot [/Users/Niel/Websites/vereniging/www/] does not exist
AH00112: Warning: DocumentRoot [/Users/Niel/Websites/voordekunst] does not exist
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using MacBook-Pro-van-Niel.local. Set the 'ServerName' directive globally to suppress this message
Failed loading /usr/local/opt/php/lib/php/20200930/opcache.so: dlopen(/usr/local/opt/php/lib/php/20200930/opcache.so, 9): no suitable image found. Did find:
/usr/local/opt/php/lib/php/20200930/opcache.so: code signature in (/usr/local/opt/php/lib/php/20200930/opcache.so) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.
/usr/local/opt/php/lib/php/20200930/opcache.so: stat() failed with errno=22
[Thu Nov 04 01:20:45.021614 2021] [mpm_prefork:notice] [pid 1903] AH00163: Apache/2.4.46 (Unix) PHP/8.0.12 configured -- resuming normal operations
[Thu Nov 04 01:20:45.021680 2021] [core:notice] [pid 1903] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
libphp
in httpd.conf
:
#LoadModule php_module /usr/lib/apache2/modules/libphp8.0.so
#LoadModule php7_module libexec/apache2/libphp7.so
#LoadModule php_module libexec/apache2/libphp.so
LoadModule php_module /usr/local/Cellar/php/8.0.12/lib/httpd/modules/libphp.so
None of these work. How to get PHP8 working?