This article explains in detail how to configure the development environment to install and configure PHP and the required libraries, to run Grav CMS under Windows operative system.

It's quite easy to install PHP under Windows, leveraging the internal web server provided since the 5.4 release. The very first thing to do is to download the latest release of PHP. You might be confused about the right version to grab, so be sure to get the VC11 x86 Non Thread Safe version.

Be sure to avoid downloading the PHP sources, because they must be compiled to work.

Next, open the downloaded file and unpack it under a path where your user can read and write. Let's supposing you will unzip it under c:\php.

The default PHP configuration comes with all the extensions disabled, so you must enable those required by Grav.

Enter the c:\php and copy the php.ini-development into the same folder, then rename it php.ini. When you are done, open it.

We are using the development file, because this file is already configured to run a development environment, which means you will be noticed when any error occurs.

Next, open the php.ini and look inside it for the string extension=php_curl.dll. You would notice it is prefixed by a semi-colon. PHP recognizes that string as a comment and ignores it.

You just need to remove that semi-colon to activate that extension, but you need to change it as follows:

extension=ext/php_curl.dll

because it is stored under the c:\php\ext. Now you just need to repeat that configuration for the following extensions:

extension=ext/php_intl.dll
extension=ext/php_gd2.dll
extension=ext/php_mbstring.dll
extension=ext/php_xsl.dll

To check the installation just run from a Windows terminal the following command:

c:/php/php -v

If you get an answer like this one:

PHP 5.6.10 (cli) (built: Jun 10 2015 15:59:37)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies

it means your environment is ready to use Grav.

This configuration works but every time you need to run PHP you have to refer to its full path, so c:\php\php.

That could become annoying in the long time, so you can configure a Windows environment variable to run the php command from every folder.

You can add a variable as follows, on a Windows7 system:

  1. Click on Start. Next, right click on Computer then choose Properties from the contextual menu to open the System panel.
  2. From that panel click on Advanced System Settings, then click on Environmnet variables.
  3. In the System variables section, look for the Path entry, click on it then click on the Edit button.
  4. Move the cursor at the end of the Variable value string, then add the ;c:\php\ string, which corresponds to the PHP folder, where the executable lives. Do not miss the semi-colon to separate this new path from others.
  5. Close all panels the reboot Windows to apply that change.

Now, just download Grav, unzip the package everywhere in your computer where your uses can read and write, then enter that folder:

cd my/grav/installation/path

then run then the PHP internal web server:

php -S localhost:8080

Now open your favorite browser and point it to:

http://localhost:8080

and you can start playing with Grav.

At last, if you need to run the Grav gpm system, just run it from your Grav installation path:

php bin/gpm

Next Post Previous Post

Related Posts