|
Posted by Erwin Moller on 03/02/06 10:48
ericgorr@gmail.com wrote:
>
> Erwin Moller wrote:
>> I took up the habbit of adding a file for every new project that contains
>> a few ini_sets, and if they fail, I let my app fail too.
>
> I would be interested to know what ini_sets you considered to be
> important.
Hi Eric,
The answer depends on the project.
But here is an example of how I do it.
This is piece of a script that gets included above every other script.
It simple defines the values I want to be sure of during the execution of my
scripts in that certain project.
Of course I could also try to overwrite ALL values in php.ini (that can can
overwritten with ini_set()), but these are the ones I picked.
---------------------------------
$iniSettings = array (
"short_open_tag" => "1",
// always on "track_vars" => "On",
"arg_separator.output" => "&",
"arg_separator.input" => "&",
"register_globals" => "0",
// magic quotes on
"magic_quotes_gpc" => "1",
"magic_quotes_runtime" => "0",
"register_argc_argv" => "1",
// max_execution_time defines the number of seconds a script may run
"max_execution_time" => "45",
// email stuff
"SMTP" => "smtp.xx.com",
"smtp_port" => "25",
// emailfrom not displayed here
"sendmail_from" => "XX@YY.com",
// Includepath!
"include_path" => ".;C:\Inetpub\wwwroot\XXXX\includes",
"default_mimetype" => "text/html",
"default_charset" => "ISO-8859-1",
// errorhandling
"error_reporting" => E_ALL,
// sessions
"session.save_handler" => "user",
"session.use_only_cookies" => "1",
"session.auto_start" => "0"
);
foreach ($iniSettings as $inikey => $inivalue){
ini_set($inikey, $inivalue);
// and test
if (ini_get($inikey) != $inivalue){
echo "UNRECOVERABLE INI-PROBLEM IN ini_settings.php.<br>";
echo "CANNOT SET $inikey to $inivalue.<br><h2>EXITING</h2>";
exit;
}
}
---------------------------------
Regards,
Erwin Moller
Navigation:
[Reply to this message]
|