CodeIgniter Forums
setup install like wordpress - Printable Version

+- CodeIgniter Forums (
+-- Forum: Using CodeIgniter (
+--- Forum: General Help (
+--- Thread: setup install like wordpress (/showthread.php?tid=74562)

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';

if ( ! write_file(APPPATH.'config/my_database.php'$data)) {
'Unable to write the file';
    } else {
'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 {
'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