CodeIgniter Forums

Full Version: setup install like wordpress
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I want to make settings to install my application like wordpress.
I tried to make a new file like wordpress.
but I have difficulty when making it.


first option :
PHP Code:
if ( ! file_exists(APPPATH.'config/my_database.php')) {

    
$data = array(
    
'$config["database_name"] = "my-name"',
    );
        //I'm having trouble creating a my_database file with values like this:
        //$config[username] = 'my-name';
        //$config[userpass] = 'my-pass';
        //etc.

        
if ( ! write_file(APPPATH.'config/my_database.php'$data)) {
        echo 
'Unable to write the file';
    } else {
        echo 
'File written!';
    }




second option  :
PHP Code:
if ( ! file_exists(APPPATH.'config/database.php')) {

    if (
copy(APPPATH.'config/database_example.php'APPPATH.'config/database.php')) {
            // I'm having a problem here, before copying data $db['defult'] = array for database.php
            // changed according to the configuration form later.
            // I tried using the file_put_contents() function but failed.

        
echo 'Copy Success';
    } else {
        echo 
'Copy Failed!';
    }


or if there is another way let me know

Please help and thank you Smile
I have a install script (not based on CodeIgniter, but plain PHP). That I personally didn't wrote but modified, maybe you can find something useful in it. In the first step it check if all folders are writable, so users can't continue and get mad that their inputted configuration didn't get saved.

I have taken some bits from Wordpress, like saving the configuration part.

php4dvd installer
i saw some wizard install scripts in web maybe they can help you