CodeIgniter Forums
setup install like wordpress - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forum-5.html)
+--- Forum: General Help (https://forum.codeigniter.com/forum-24.html)
+--- Thread: setup install like wordpress (/thread-74562.html)



setup install like wordpress - DELE - 10-08-2019

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


RE: setup install like wordpress - jreklund - 10-09-2019

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


RE: setup install like wordpress - saeednajafi - 10-09-2019

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