In some circumstances you may need to add, edit, delete or check the value of an item in the server's configuration file. This article explains the process of editing and validating that file.
You will need the following:
Version 2006 and above of the server include a command line utility, ffconfig, to simplify working with config.inc.php. To use ffconfig:
The first argument, the command should be one of the following choices shown in bold:
list - lists the config.inc.php file.
root@appliance:~ # ffconfig list
set - set the value of a variable. This command requires a second argument which is the name of the variable to be set. It also requires a third argument which is the value to assign to the variable. Enclose the value in quotes.
ffconfig set debug_filter 'opens3'
get - show the value of a variable. This command requires a second argument which is the name of the variable to be shown.
ffconfig get debug_filter
delete - remove a variable and its value from the config file. This command requires a second argument which is the name of the variable to be deleted.
ffconfig delete debug_filter
unset - remove the value from variable. This command requires a second argument which is the name of the variable that will have its value removed.
ffconfig unset debug_filter
The server's core configuration file is at:
/var/www/smestorage/public_html/config.inc.php
Look at the configuration file:
less /var/www/smestorage/public_html/config.inc.php
Settings are in the format:
// A comment var $variablename = 'value';
Many of these settings are required and must not be changed or removed unless you are instructed to do so.
The configuration file is also sensitive to the format in which elements are written, so it is important to ensure that these instructions are followed.
If you intend to make changes to the configuration file, we recommend that you take a backup, and also a working copy. For example:
cd /var/www/smestorage/public_html cp config.inc.php config.inc.php.backup cp config.inc.php config.inc.php.copy
Once this has completed, first make any changes to the working copy. For example,
nano config.inc.php.copy
Once your changes have been completed, you should verify that they carry the correct syntax by running:
php -l config.inc.php.copy
If the above reports no errors, you can then move the file into place as follows:
mv config.inc.php.copy config.inc.php
To add a new configuration item into the configuration file first check to ensure that there is not already a line with the $variablename you intend to add, as duplicates will cause an error. Check by searching the file. For example, to search for sitetitle
you could use:
grep sitetitle config.inc.php
If the item already exists you can change its value as described in the Changing a Configuration Item section. To add new setting, find an existing configuration item within the file, and add a new line beneath it. On the new line, add the configuration item you have been requested to add.
Save and quit the file and follow the above instructions below for checking and moving the copy into place.
When changing a configuration item, follow the above instructions above for Making Changes Safely.
To change a configuration item, open the copy of the configuration file and perform a search within the file to locate the item you are required to edit. Make the change and save the edited file.
When removing a configuration item, follow the above instructions above for Making Changes Safely.
To remove a configuration item, open the copy of the configuration file and perform a search within the file to locate the item you are required to remove, then remove the item and save the edited file.
One of the most common reasons to edit the configuration file is to add a debug filter. For example, to activate debugging for the OpenS3 connector you would include this line in config.inc.php:
var $debug_filter='opens3';
The value of the debug filter can be a list of zero or more values, for example:
var $debug_filter=''; //no debugging filers active var $debug_filter='opens3'; // a single value var $debug_filter='opens3|another_filter_name'; // two or more values separated by pipes
Only add debug filters when directed to do so by Support. Debug output can consume a lot of disk space quickly. As soon as debug output is no longer needed the debug_filter line should be removed or commented out or the list of values should be emptied.