Welcome Guest, Not a member yet? Register   Sign In
setup install like wordpress
#1

(This post was last modified: 10-08-2019, 01:32 PM by DELE.)

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
Reply


Messages In This Thread
setup install like wordpress - by DELE - 10-08-2019, 01:25 PM
RE: setup install like wordpress - by jreklund - 10-09-2019, 10:32 AM
RE: setup install like wordpress - by saeednajafi - 10-09-2019, 04:30 PM



Theme © iAndrew 2016 - Forum software by © MyBB