What are PHP Directives and how can I use them?

The configuration of PHP is dependent on the values being used for the various settings that can be made for the configuration of an environment. These settings are called directives. They can be used to tweak the default configuration provided by Servebolt. 

The default PHP configuration on our Bolts is highly geared towards performance. We therefore highly recommend not to change this configuration. In some specific cases it might be desirable to do so, but try to keep changes to a minimum. 

How can I set these PHP Directives?

The best way to set PHP Directives on your Environment would be through the .htaccess file used by this environment. If it doesn’t exist yet, you can create one using your favourite editor. Setting a directive can be done as follows. On a new line, add the following information:

php_value php_directive_name value

All you’d need to do would be to substitute php_directive_name with the name of the directive that you want to set. After that, set the correct value as well. Save the file in the public folder of your environment. As soon as it’s there, the changes should become noticeable.

How can I check the current settings?

If we want to check what directives are in use by your environment, there is an easy way to check these. PHP has a built-in function that will allow us to list out all currently set directives. In this case, all we need to add to a (empty) PHP file would be the following:

phpinfo( 4 );

The value 4 is used in this function to only display the directives. If we would call the phpinfo() function without it, it would give us all the information concerning the PHP setup. All options for this function can be found in the official documentation.

Once the file is in place on your Environment, you can access it using your browser. It will display all values set for your environment. Keep in mind that this file might be cached. So if values seem to be wrong or outdated, flush the cache first!