<?php
// Put all the php.ini parameters you want to change below. One per line.
// Follow the example format $parm[] = "parameter = value";
$parm[] = "register_globals = Off";
//$parm[] = "session.use_trans_sid = 0";
// full unix path - location of the default php.ini file at your host
// you can determine the location of the default file using phpinfo()
$defaultPath = '/usr/local/Zend/etc/php.ini';
// full unix path - location where you want your custom php.ini file
$customPath = "/home/yourusername/public_html/php.ini";
// nothing should change below this line.
if (file_exists($defaultPath)) {
$contents = file_get_contents($defaultPath);
$contents .= "\n\n; USER MODIFIED PARAMETERS FOLLOW\n\n";
foreach ($parm as $value) $contents .= $value . " \n";
$handle = fopen($customPath, 'w');
if (fwrite($handle, $contents)) {
fclose($handle);
if (chmod($customPath,0600)) $message = "The php.ini file has been modified and copied";
else $message = "Processing error - php.ini chmod failed";
} else {
$message = "Processing error - php.ini write failed";
}
} else {
$message = "Processing error - php.ini file not found";
}
echo $message;
?>
$customPath = "/home/yourusername/public_html/php.ini";
<?php
//*set*this*value*to*Y*if*you*only*want*to*overwrite*old*php.ini*files
//*set*this*value*to*N*if*you*want*to*put*a*php.ini*file*in*every*directory
$overwriteOnly*=*"N";
if*($overwriteOnly*==*"Y")*echo*"Operating*in*Overwrite*Only*Mode<br><br>";
$path*=*"/home/"*.*get_current_user()*.*"/public_html";
$source*=*$path*.*"/php.ini";
if*(!file_exists($source))*die('Error*-*no*source*php.ini*file');
function*search($dir)*{
**global*$source;
**global*$overwriteOnly;
**$dh*=*opendir($dir);
**while*(($filename*=*readdir($dh))*!==*false)*{
****if*(*$filename*!==*'.'*AND*$filename*!==*'..'*AND*$filename*!==*'cgi-bin'*AND*is_dir("$dir/$filename")*)*{
******$path*=*$dir."/".$filename;*
******$target*=*$path*.*"/php.ini";
******if*(!file_exists($target)*AND*$overwriteOnly*==*"Y")*{
********echo*"$path*<b>skipped*-*no*php.ini*file</b><br>";
******}*else*{
********echo*"$target*<br>";
********if*(!copy($source,$target))*echo*"<b>Write*failed*for*$target*</b><br>";
********if*(file_exists($target))*chmod($target,0600);
****}
******search($path);
****}
**}
**closedir($dh);
}
search($path);
echo*"<br>Done.";
?>
Time to create page: 0.054 seconds