CATEGORY: PHP

QUESTION:
Personal PHP Configuration

ANSWER:
Many end users have requested the ability to setup custom settings in PHP( i.e. include_path, error_log, magic_quotes_gpc, sendmail_from...). Since we support two different versions of PHP, use the method below for your server's version.



PHP3:
This is fairly easy for end users to implement.

The user can modify his/her settings using a '.htaccess' file. To modify the settings in PHP3, the user will need to put the prefix 'php3_' before each of the settings he/she wants to modify. Below is an example of what the .htaccess file could look like:
----------------------------------------------------
php3_include_path "./:/usr/local/lib/php:/home/$user/www/php/"
php3_auto_prepend_file "/home/$user/www/php/prepend.php3"
php3_error_log "/home/$user/www/php/error_log"
php3_magic_quotes_gpc On
----------------------------------------------------
Notice that you set the options by stating the option that you wish to modify, followed by the value that you want to set it to.



PHP4:
With PHP4 there are two options for modifying the settings. The method above will work with a few changes and the end user can also change the settings actually in the PHP script. Below are the different ways to modify the settings:


Method 1:
Rather than preceding each option with 'php3_', you will need to precede the settings with one of two clauses: 'php_value ' or 'php_flag '. [Notice that these clauses are followed by a space.] The php_value setting allows you to modify an option that requires a value, while php_flag lets you modify an option that is either On or Off. Below is an example:

----------------------------------------------------
php_value include_path "./:/usr/local/lib/php:/home/$user/www/php/"
php_value auto_prepend_file "/home/$user/www/php/prepend.php3"
php_value error_log "/home/$user/www/php/error_log"
php_flag magic_quotes_gpc On
----------------------------------------------------


Method 2:
The settings can also be set in the actual PHP script using the command 'ini_set'. [Notice that the On/Off setting is now set with 1/0].

Example of this:
----------------------------------------------------
ini_set("include_path", "./:/usr/local/lib/php:/home/$user/www/php/");
ini_set("auto_prepend_file", "/home/$user/www/php/prepend.php3");
ini_set("error_log", "/home/$user/www/php/error_log");
ini_set("magic_quotes_gpc", 1);
phpinfo();
?>
----------------------------------------------------



Eddie
############################################################

Please be advised that this is a SUPPLEMENTAL Online Manual.

The PRIMARY Online Manual is inside your Online Control Panel... to access it, just click Documentation link at very bottom of Online Control Panel screen.

You should always consult the Online Manual inside your control panel first... and only consult this SUPPLEMENTAL Online Manual as a last resort.

if after consulting the Control Panel Documentation, you still need assistance, please CONTACT SUPPORT

top