More universal way to config phpliteadmin

Issue #381 new
Jan Turoň created an issue

I use url redirect and call phpliteadmin like this:

if($GLOBALS["URL"]["path"]==$SQLITE_ADMIN_PATH) {
  exit(include("data/sqlite/phpliteadmin.php"));
}

(I do not want to redirect it to real path because some ports on some servers can be opened and clients could download the php file, so phpliteadmin.php dwells in directory accessible only by www-data user.)

Then there is an issue reading the phpliteadmin.config.php file: phpliteadmin doesn’t see it on path . because it was included from different path and including manually has no effect because in phpliteadmin.php the default values ($password, $directory etc.) are set and then (in the middle) the config file can overwrite it.

(Of course I could set the config values directly in phpliteadmin.php, but then I have to overwrite them every time I download new version of phpliteadmin. That does not happen often, but I use it on multiple places and it would be nice if I don’t have to remember where to set what.)

Therefore I propose that phpliteadmin tries to load the config file first and then overwrite the values ($password, $directory etc.) if they are not defined. With this approach the values could be set also from php script that includes phpliteadmin.

Comments (4)

  1. Jan Turoň reporter

    I also fixed the issue by altering line 428 to

    $config_filename = dirname(__FILE__).'/phpliteadmin.config.php';

  2. Jan Turoň reporter

    Alas, that did not work on my Mongoose web server with php-cgi. In the php they say the reason might be setting `php_value include_path`, but I am not sure how Mongoose does that (it has no similar setting in conf file). The line in phpliteadmin is $config_filename = './phpliteadmin.config.php'; - doesn’t the leading dot mean that the current directory is used, regardless of include path (in my case the script that includes, not phpliteadmin itself)?

  3. Log in to comment