Move configuration outside public_html | Joomla Support | Forum Archive

The free forums are no longer in use. It remains available as read-only archive.

Avatar
Lost password?
Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
The forums are currently locked and only available for read only access
sp_TopicIcon
Move configuration outside public_html
August 6, 2012
11:51 am
Avatar
Guest
Guests

I think the application is excellent, but would be much better if you can move the configuration file outside the public_html folder because in this way greatly reduces the risk of data falling into the wrong hands. In the configuration file are saved password of the database and Amazon S3 keys, how I can move the configuration file at home?

August 6, 2012
1:15 pm
Avatar
Ovidiu Liuta
Admin
Forum Posts: 2484
Member Since:
September 26, 2010
sp_UserOfflineSmall Offline

Please check this page http://docs.joomla.o.....web_root , it should help!

 

Ovidiu

August 6, 2012
2:21 pm
Avatar
Guest
Guests

oh, sorry for the confusion.

I meant to move the configuration file xcloner outside the public_html folder, not joomla.

August 7, 2012
5:35 am
Avatar
Ovidiu Liuta
Admin
Forum Posts: 2484
Member Since:
September 26, 2010
sp_UserOfflineSmall Offline

You can do that with XCloner as well, simply move the cloner.config.php file to the new location, and replace the old location file code with an include to the new path. One thing that will not work anymore is the config save, but i don't think you need to deal with that once all settings are properly setup.

 

Ovidiu

August 7, 2012
5:43 am
Avatar
Guest
Guests

Yes, that solution is very good. Thank you very much.

And friends, I like to give their facebook:
http://www.facebook......8963742631

October 16, 2012
12:37 pm
Avatar
Guest
Guests

I modified xCloner to suit my needs.

 

I am running a live/test environment on the same domain. The live site is located in the public_html/, and the test site at public_html/test/.

Joomlas configuration.php that as an example for the live site has been moved to /randomFolderName/configuration.php that is defined in /public_html/defines.php and /public_html/administrator/defines.php as JPATH_CONFIGURATION.

What the modification does is that it does an reversed-recursive lookup of defines.php to locate where the configuration directory really is.

This essentially means that I am able to move both Joomlas configuration file and as well xcloner – with the possibility to clone sites and read/write independantly to the configuration files as long as each site has it's own randomFolderName for storing the configuration files outside of public_html.

The drawback is that there is no backup taken of the configuration files since they don't reside withing Joomlas directory.

My modifications may very well suit your own needs if you incorporate it with moving Joomlas config files.

 

I modified admin.cloner.php with this:

 

define("_VALID_MOS", 1);
//load configuration
    
    /* Modification Start */
    
    // Set Joomla flag to be able to load defines.php
    define('_JEXEC', 1); //Fake Joomla authority
    define('DS', DIRECTORY_SEPARATOR);
    // Locate defines.php upwards in tree structure
    $xclonedir = dirname(__FILE__);
    $joomlaroot = $xclonedir;
    $defines = DS.'defines.php';
    
    //Try to locate and load defines.php
    while(!include_once($joomlaroot.$defines)) {
        $joomlaroot = dirname($joomlaroot);
    }
    
    //Append true configurationfolder to config file
$config_file = JPATH_CONFIGURATION.DS.'cloner.config.php';
    
    //Debug dumps
    //die(var_dump($joomlaroot));
    //die(var_dump($config_file));
    
    /* Modification End */
    require_once($config_file);
October 16, 2012
1:22 pm
Avatar
Guest
Guests

Chri said:

I modified xCloner to suit my needs.

 

I am running a live/test environment on the same domain. The live site is located in the public_html/, and the test site at public_html/test/.

Joomlas configuration.php that as an example for the live site has been moved to /randomFolderName/configuration.php that is defined in /public_html/defines.php and /public_html/administrator/defines.php as JPATH_CONFIGURATION.

What the modification does is that it does an reversed-recursive lookup of defines.php to locate where the configuration directory really is.

This essentially means that I am able to move both Joomlas configuration file and as well xcloner – with the possibility to clone sites and read/write independantly to the configuration files as long as each site has it's own randomFolderName for storing the configuration files outside of public_html.

The drawback is that there is no backup taken of the configuration files since they don't reside withing Joomlas directory.

My modifications may very well suit your own needs if you incorporate it with moving Joomlas config files.

 

I modified admin.cloner.php with this:

 

<?php
define("_VALID_MOS", 1);
//load configuration
    
    /* Modification Start */
    
    // Set Joomla flag to be able to load defines.php
    define('_JEXEC', 1); //Fake Joomla authority
    define('DS', DIRECTORY_SEPARATOR);
    // Locate defines.php upwards in tree structure
    $xclonedir = dirname(__FILE__);
    $joomlaroot = $xclonedir;
    $defines = DS.'defines.php';
    
    //Try to locate and load defines.php
    while(!include_once($joomlaroot.$defines)) {
        $joomlaroot = dirname($joomlaroot);
    }
    
    //Append true configurationfolder to config file
$config_file = JPATH_CONFIGURATION.DS.'cloner.config.php';
    
    //Debug dumps
    //die(var_dump($joomlaroot));
    //die(var_dump($config_file));
    
    /* Modification End */
    require_once($config_file);

Spoke to soon.
 

Didn't realize XCloner has hardcoded to import the config in more places.

The correct solution therefore is:

 

Move your configfile to the same directory as Joomlas configuration file.

Create a new file were cloner.config.php was and put this code in WITH OPENING PHP TAG (can't get code formatting to work on this forum, moderator may edit):

 

    /* Modification Start */
    
    // Set Joomla flag to be able to load defines.php
    define('_JEXEC', 1); //Fake Joomla authority
    define('DS', DIRECTORY_SEPARATOR);

    // Locate defines.php upwards in tree structure
    $xclonedir = dirname(__FILE__);
    $joomlaroot = $xclonedir;
    $defines = DS.'defines.php';
    
    //Try to locate and load defines.php
    while(!include_once($joomlaroot.$defines)) {
        $joomlaroot = dirname($joomlaroot);
    }
    
    //Append true configurationfolder to config file
  $config_file = JPATH_CONFIGURATION.DS.'cloner.config.php';
    
    //Debug dumps
    //die(var_dump($joomlaroot));
    //die(var_dump($config_file));
    
    /* Modification End */
    require_once($config_file);

February 18, 2013
8:40 am
Avatar
Omo
Member
Members
Forum Posts: 7
Member Since:
February 18, 2013
sp_UserOfflineSmall Offline

@Chri - Thanks for providing this solution. Can you please clarify the following

  1. You said to copy the code "WITH OPENING PHP TAG". Does that mean copy within the <?php... >tag.
  2. After copying this code, do we save the new file as cloner.config.php? So technically replacing the default cloner.config.pgh file which has now been relocated to the new location outside of the Joomla root?

Thanks

February 18, 2013
2:34 pm
Avatar
Guest
Guests

Omo said:

@Chri - Thanks for providing this solution. Can you please clarify the following

  1. You said to copy the code "WITH OPENING PHP TAG". Does that mean copy within the <?php... >tag.
  2. After copying this code, do we save the new file as cloner.config.php? So technically replacing the default cloner.config.pgh file which has now been relocated to the new location outside of the Joomla root?

Thanks


Omo,
 

To be perfectly honest I can't remember how I solved it.

1. Yes - add "<?php" in the beginning of the PHP-file.

(skip the ending of PHP-tag, it can only cause problems)

 

2.

 

I think my solution was to do the following:

 

Move default configuration file.

 

Create a new configuration file with the same name as the default, but put in the code above.

What happens is that XCloner loads the file as it normally would - but that now contains the modified code, which then in turns searches for the TRUE configfile through recursive lookup and includes it through the require statement.

Forum Timezone: America/Chicago
Most Users Ever Online: 867
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
mlguru: 30
Django29: 29
Andy: 21
D: 21
Marcus: 20
Jamie F: 19
Member Stats:
Guest Posters: 738
Members: 10030
Moderators: 2
Admins: 3
Forum Stats:
Groups: 3
Forums: 7
Topics: 2397
Posts: 8236
Newest Members:
Omar Vera
Moderators: TriP: 0, Steve Burge: 0
Administrators: Ovidiu Liuta: 2484, Victor Drover: 1, Valentin Barbu: 0