Score:0

Apache2 serves PHP as plain text after updating to PHP 8

in flag

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?

Score:0
ng flag

Did you install libapache2-mod-php8.0 and php8.0-fpm and enable it? (a2enmod proxy_fcgi setenvifanda2enconf php8.0-fpm) If you did not, enable it. If you did enable it, then there is some other problem.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.