note 23408 deleted from function.parse-ini-file by victor

From: Date: Sat, 19 Jun 2004 15:20:12 +0000
Subject: note 23408 deleted from function.parse-ini-file by victor
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-71358@lists.php.net to get a copy of this message
Note Submitter: cyberkill3r@hotmail.com ---- If you want to edit a ini file using php try this function: <?php //Edit ini files function edit_ini($ini_file, $what, $replace){ $fp = fopen($ini_file, "r");//open file $contents = fread($fp, filesize($ini_file)); fclose($fp); $new_contents = ereg_replace($what, $replace, $contents); $fp = fopen($ini_file, "w"); fwrite($fp, $new_contents); fclose($fp); echo "Ini file saved"; } ?> usage: edit_ini(ini_file, replace configuration, replace with); //example: This is replace SMTP = localhost to SMTP = 127.0.0.1 in php.ini edit_ini("php.ini", "SMTP = localhost", "SMTP = 127.0.0.1"); ++hope to help ++ckill3r

« previous php.notes (#71358) next »