Possible Duplicate:
writing to a .php file?
So I have a config.php file for a CMS that I created from scratch. This file has the structure shown below:
<?php
date_default_timezone_set( "America/Phoenix" );
define( "DB_HOST_USER", "mysql:host=localhost;dbname=db_cms" );
define( "DB_USERNAME", "username" );
define( "DB_PASSWORD", "password" );
define( "CMS_TITLE", "Sample Title");
define( "USERNAME", "cms_user");
define( "PASSWORD", "cms_password");
?>
My question is that how can I write into this file and save it to the disk using PHP. Help would be greatly appreciated.
Edit: I saw that WordPress uses similar kind of file structure to store user/application configuration as outlined here. I was just wondering if I can change above file (config.php) and store new setting in there. For instance, I want to set USERNAME to blog_user (define( "USERNAME", "blog_user");
). Is it possible to just store this change without rewriting the entire file?