My local apache2 server is not playing nice with my grav setup. I can run the local server bin/grav server
and it looks fine when I browse to http://127.0.0.1:8000
so I assume I have PHP and dependencies working okay.
When I try and run from apache it’s not so good. I get what looks like a mangled attempt to display php as html, or just text:
php -S {$_SERVER['SERVER_NAME']}:{$_SERVER['SERVER_PORT']} system/router.php"); } } // Ensure vendor libraries exist $autoload = __DIR__ . '/vendor/autoload.php'; if (!is_file($autoload)) { die('Please run: bin/grav install'); } // Register the auto-loader. $loader = require $autoload; // Set timezone to default, falls back to system if php.ini not set date_default_timezone_set(@date_default_timezone_get()); // Set internal encoding. @ini_set('default_charset', 'UTF-8'); mb_internal_encoding('UTF-8'); use Grav\Common\Grav; use RocketTheme\Toolbox\Event\Event; // Get the Grav instance $grav = Grav::instance(array('loader' => $loader)); // Process the page try { $grav->process(); } catch (\Error|\Exception $e) { $grav->fireEvent('onFatalException', new Event(array('exception' => $e))); throw $e; }
It looks like it might be trying to signal an error but I can’t see what.
My apache2 default page shows up okay (localhost:80
) and to get apache2 to see my local grav site I added this:
<VirtualHost *:80>
ServerName grav
ServerAlias grav
DocumentRoot /home/roger/public_html/grav
<Directory /home/roger/public_html/grav>
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
ErrorLog logs/localhost-error_log
CustomLog logs/localhost-access_log common
</VirtualHost>
and I edited my /etc/hosts
to declare the grav
host at 127.0.0.1
.
If I browse to an index.html file I put in that directory (http://grav/index.html
) it does show up just fine. So the problem occurs when it hits the index.php
file.
It must be something I have missed in the apache2 setup. Anyone know what I missed?
PHP version 8.1.2
Grav 7.1
Ubuntu 22.04
apache2 2.4.52