Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

General

Install problem - the success page does not appear, instead I see the index.php file

Started by nir shaked 6 years ago · 3 replies · 881 views
6 years ago

Hi everyone,
In the installation section it says that a successful installation will lead to a grav page in the localhost - so I reach it through the adress http://localhost/grav-admin/

I don't get an error but I definitely don't see the page that should be there. Instead I see the index.php file as text:

PHP
<?php

/**
 * @package    Grav.Core
 *
 * @copyright  Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved.
 * @license    MIT License; see LICENSE file for details.
 */

namespace Grav;

\define('GRAV_REQUEST_TIME', microtime(true));
\define('GRAV_PHP_MIN', '7.1.3');

if (version_compare($ver = PHP_VERSION, $req = GRAV_PHP_MIN, '<')) {
die(sprintf('You are running PHP %s, but Grav needs at least <strong>PHP %s</strong> to run.', $ver, $req));
}

if (PHP_SAPI === 'cli-server' && !isset($_SERVER['PHP_CLI_ROUTER'])) {
die("PHP webserver requires a router to run Grav, please use: <pre>php -S {$_SERVER['SERVER_NAME']}:{$_SERVER['SERVER_PORT']} system/router.php</pre>");
}

// Set timezone to default, falls back to system if php.ini not set
date_default_timezone_set(@date_default_timezone_get());

// Set internal encoding.
if (!\extension_loaded('mbstring')) {
die("'mbstring' extension is not loaded.  This is required for Grav to run correctly");
}
@ini_set('default_charset', 'UTF-8');
mb_internal_encoding('UTF-8');

// Ensure vendor libraries exist
$autoload = __DIR__ . '/vendor/autoload.php';
if (!is_file($autoload)) {
die('Please run: <i>bin/grav install</i>');
}

// Register the auto-loader.
$loader = require $autoload;

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 $e) {
$grav->fireEvent('onFatalException', new Event(array('exception' => $e)));
throw $e;
} catch (\Exception $e) {
$grav->fireEvent('onFatalException', new Event(array('exception' => $e)));
throw $e;
}

I would appreciate any help 🙂
btw - this is the first time I use grav CMS
Thank you

6 years ago

Thanks!
This page was vrey helpful
Eventually the thing that solved the problem was trying to open manually the index.php file. When I tried to open it it asked me to install xcode tools (or something like that) - after installing it the page appeared correctly 🙂
thanks

6 years ago

Good to know - once you've got it all set up once it'll work flawlessly but you can hit some speedbumps the first time around. Could you mark this as solved? Cheers.

Suggested topics

Topic Participants Replies Views Activity
General · by Jerry Hunt, 4 days ago
2 82 10 hours ago
General · by pamtbaau, 16 hours ago
1 53 15 hours ago
General · by Andy Miller, 1 day ago
0 45 1 day ago
General · by Marcel, 12 months ago
6 347 5 days ago
General · by Duc , 5 days ago
3 41 5 days ago