[FIXED] Path to config.ini.php

I’d like to see an option in the install process to store config.ini.php in another location. I was a bit shocked to find my DB log-in details in a public folder; my usual practice is to keep that sort of thing in a private folder and use a PHP ‘include’ to access it.

As a temporary solution I’ve edited the relevant function in Config.php as follows:

    static public function getDefaultUserConfigPath()
    {
        return '[my private path]/config/config.ini.php';
    }

Sorry, this is a Wontfix. The contents of config/config.ini.php shouldn’t be readable from the browser. You can also use mod_rewrite or .htaccess to redirect or block access to that folder, respectively.

OK, no worries. Hacking the path seems to have thrown something anyway, as hits were being ignored. I’m going to use .htaccess to make the folder private (mod_rewrite can be a bit slow in my experience).

I’m probably being paranoid, but my fear would be what might happen if the php engine got broken for whatever reason and the page got served unprocessed.

I think your concern if fair enough. please create a ticket to add a .htaccess deny from all in the config folder

.htaccess added will be available in 0.2.33

Hi,

We justed installed Piwik somewhere on our server, so each hosting-account can have access with a symlink.
But they also should have there own database and settings.

I found the bootstrap.php solution style_emoticons/<#EMO_DIR#>/wink.gif
But this is not helpfull for the config.ini.php

In the settings it is now possible to set:
PIWIK_INCLUDE_PATH
PIWIK_DOCUMENT_ROOT

Why not have: PIWIK_PATH_CONFIG to set the path to the user-config.
This does NOT mean that it can be seen in the browser!

I also made a hack in config.php etc.
It are really small changes and Piwik can be installed serverside!!!

I do hope this request will be reviewed and set to: will fix !! :slight_smile:

Greetz, Joly

Joly: please create a ticket in Trac and attach your patch. Thanks.

Ohoh trac-newbie here style_emoticons/<#EMO_DIR#>/wink.gif
Is there some prob? I cannot login to trac.
See the other post in the general forum about ‘dev.piwik.org

Trac doesn’t use the forum’s login. You’ll have to register.

That said, I’ve already made some changes in svn, but could use some further testing… Define PIWIK_USER_PATH in bootstrap.php to relocate the config and tmp folders.

Jep, I did that. But after login, the page cannot load.

Please look at my reaction in:
‘dev.piwik.org is unavailable’
There is endless loop or something.

Thanks for updating, i will logout in trac to take a look style_emoticons/<#EMO_DIR#>/wink.gif

WOW, THANKS!

I downed the latest trunk and started a new install.
After setting the right paths in de user-account, i found just one issue: smarty could not find the piwik-plugins.

I am not sure if it is the correct Piwik-way, but this is what i changed in core/view.php

line 42. _construct()

$tmp1=
$tmp2 = $smConf->template_dir->toArray();
array_walk($tmp1, array("Piwik_View","addPiwikPath"));
if(PIWIK_USER_PATH !== PIWIK_INCLUDE_PATH){
    array_walk($tmp2, array("Piwik_View","addPiwikPath"),true);
    $this->smarty->template_dir = array_merge($tmp1,$tmp2);
}else{
    $this->smarty->template_dir = $tmp1;
}

I have not tested any templates-changes yet. So maybe the ordering is not right. With this change, smarty will look into the piwik-core root and into the user-path.
The plugins remain in the piwik-core.

somewhere round line 188

static public function addPiwikPath(&$value, $key, $isUserPath=false)
{
    if($value[0] != '/' && $value[0] != DIRECTORY_SEPARATOR)
    {
        if($isUserPath){
            $value = PIWIK_USER_PATH ."/$value";
        }else{
            $value = PIWIK_INCLUDE_PATH ."/$value";
        }
    }
}

Sorry for posting here.
But I still cannot login to trac.

Thank you so much for making the new constant!

Greetz, Joly

No. If you have a single Piwik installation that might be shared between accounts, you don’t want your tmp folder to be shared also.

PIWIK_USER_PATH should contain your config and tmp folders. (There’s a reason why I didn’t call it PIWIK_CONFIG_PATH.)

Yupz, indeed!

By the way…
The code I posted, was not about the tmp-folder. But the smarty-plugins.

Gotcha.