Controlling PHP - PHP Scripts
(Page 5 of 6 )
The final way one can control the behavior of PHP is by using the function ini_set function that sets the value of a configuration option. The ini_set function accepts two arguments: the first is the option name, the second is the option's value. The new value is kept throughout the execution of the current script, after which PHP reverts back to its original configuration.
Options which are boolean in nature are set to either 1 (on) or 0 (off). Other options are set with quoted/string values.
This method of configuration can be especially useful for satisfying per-script needs, such as specifying the include path for files, the maximum allowed execution time for a script and error reporting. Here's an example usage:
<?php ini_set("max_execution_time", "60"); ini_set("display_errors", 1); ?> |
In this example, ini_set is used to extend the maximum allowed execution time of the script to 60 seconds. The display errors option has been set to override a production environment's suppression of errors.
Next: Conclusion >>
More Miscellaneous Articles
More By bluephoenix