What are PHP Directives and how can I use them?

PHP’s configuration depends on the values used for the various site settings, which are called directives. These settings 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 site would be through the .htaccess file used by this site. 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 site. 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 site, 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:

<?php
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 site, you can access it using your browser. It will display all values set for your site. Keep in mind that this file might be cached. So if values seem to be wrong or outdated, flush the cache first!