Grav with PHP 5.6 ini_set() fix


On my hosting provider, there is a slight tweak needed to get Grav to run on PHP 5.6. Here's the solution:

From cPanel > Select PHP Version, and from the PHP Selector page, set PHP 5.6 as the current version.

cPanel Select PHP Version page

Now, I get this error from Grav:

Whoops \ Exception \ ErrorException (E_WARNING)

ini_set() has been disabled for security reasons

Grav with PHP 5.6 set_ini() error

The function ini_set() is considered unsafe, and is disabled by default. However, Grav will abort without it - perhaps it should be optional, but for now, you'll have to re-enable ini_set().

To enable the function, this is what I did:

  1. Create / edit php.ini in my public_html folder, and add:
    ini_set = on

Depending on your level of access and hosting provider, you could also try either:

  1. Create / edit .htaccess in your public_html folder, and add this line, replacing username with your cPanel username:

    suPHP_ConfigPath /home/username/public_html/
  2. Or, if you have root access to php.ini in /usr/local/lib/, you could directly remove ini_set from the exclusions. That is, look for disable_functions = and remove ini_set if it is present.