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.

Installation & Hosting

Windows installation issues: 'mbstring' extension is not loaded

first-time

Solved by pamtbaau View solution

Started by Nemanja Stabic 5 years ago · 4 replies · 3308 views
5 years ago

Hi there,
I am new to Grav and wanted to set up an environment on my PC to play around with it.
I'm using Windows 10, and I followed the following steps to install:

  1. Downloaded Grav Core + Admin Plugin and extracted it to my wwwroot folder
  2. Installed PHP and added it to environment variables as per this article
    php -v PHP 8.0.1 (cli) (built: Jan 5 2021 23:43:33) ( NTS Visual C++ 2019 x64 ) Copyright (c) The PHP Group Zend Engine v4.0.1, Copyright (c) Zend Technologies
  3. Added the .php mime type to my IIS site as type text/html
  4. Enabled mbstring in the php php.ini-development and php.ini-production files in C:\php
  5. Created a "Hello World" script in an html page and browsed to it successfully on my browser
  6. This is where the trouble starts
    Tried to add a user to the admin plugin via command line as per this article
    On cmd I browse to the grav-admin/bin directory and run php plugin login new user
    and I am greeted with this error: 'mbstring' extension is not loaded. This is required for Grav to run correctly
  7. I also tried to browse to the ...grav-admin\index.php page and I see this error:
    PHP %s to run.', $ver, $req)); } if (PHP_SAPI === 'cli-server') { $symfony_server = stripos(getenv('_'), 'symfony') !== false || stripos($_SERVER['SERVER_SOFTWARE'], 'symfony ') !== false; if (!isset($_SERVER['PHP_CLI_ROUTER']) && !$symfony_server) { die("PHP webserver requires a router to run Grav, please use: php -S {$_SERVER['SERVER_NAME']}:{$_SERVER['SERVER_PORT']} system/router.php "); } } // 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: bin/grav install'); } // 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've trolled through a few articles online and none of them really make sense, so I am hoping someone on here can help me? There was another topic like this on here, but the issue there seemed with the person's php version (mine is v8.0.1).

This has really been a deterrent for me trying to see if Grav will be useful for me, I'm hoping that I can sort out the installation so that I can finally get to play around.

Thanks in advance,

5 years ago Solution

@nemza,

  1. Enabled mbstring in the php php.ini-development and php.ini-production files in C:\php

Did you copy/rename php.ini-development or php.ini-production to php.ini?

Also note that Grav cli commands should be run from the root of the site instead of its /bin folder. Eg. bin/plugin login new-user

👍 1
5 years ago

This won't answer your question per se, but did you try Laragon? It's listed as the first option in the Requirements section for Windows. It took me like 5-10 minutes to get going :)

👍 1
last edited 02/01/21 by Karmalakas
5 years ago

Thank you so much! changing the file extension to just .ini worked!

Suggested topics

Topic Participants Replies Views Activity
Installation & Hosting · by antoinep, 13 hours ago
5 60 8 hours ago
Installation & Hosting · by Jürgen Dietrich, 7 months ago
0 62 7 months ago
Installation & Hosting · by rappluk, 8 months ago
0 62 8 months ago
Installation & Hosting · by N, 12 months ago
3 72 12 months ago
Installation & Hosting · by Youle, 1 year ago
1 61 1 year ago