docker icon indicating copy to clipboard operation
docker copied to clipboard

show/create config.user.inc.php instead of config.inc.php if run on Docker instance

Open emanuelb opened this issue 7 years ago • 6 comments

User modifications when run from docker https://github.com/phpmyadmin/docker need to be made in config.user.inc.php file instead of config.inc.php. Thus, show 'config.user.inc.php' instead of 'config.inc.php' if run from Docker, for example change need to be done in: https://github.com/phpmyadmin/phpmyadmin/blob/master/prefs_manage.php#L51 https://github.com/phpmyadmin/phpmyadmin/blob/master/prefs_manage.php#L309 https://github.com/phpmyadmin/phpmyadmin/blob/master/setup/frames/config.inc.php#L30 https://github.com/phpmyadmin/phpmyadmin/blob/master/libraries/relation.lib.php#L371 also the file created under SETUP need to be 'user.config.inc.php' in the above scenario.

emanuelb avatar Oct 04 '16 07:10 emanuelb

The similar change might make sense for Linux distributions as well (to tell people to update /etc/phpmyadmin/config.inc.php). In the end it should be configurable by libraries/vendor_config.php.

nijel avatar Mar 21 '17 09:03 nijel

@emanuelb is this issue still up to date ?

williamdes avatar Jan 24 '20 12:01 williamdes

@emanuelb I moved the issue here, could you post an update for 2020 ?

williamdes avatar May 09 '20 10:05 williamdes

still relevant, "config.inc.php" string need to be replaced with variable usage in codebase, there is defined: define('CONFIG_FILE', CONFIG_DIR . 'config.inc.php'); in vendor_config.php file, use it instead of "config.inc.php", some examples (there probably more in code, in some places a call to basename is needed as only the filename is needed and not the full-path) https://github.com/phpmyadmin/phpmyadmin/blob/7ca6705eafa5b867ac6e45d65374569be06abe51/setup/config.php#L42 https://github.com/phpmyadmin/phpmyadmin/blob/3a9b76291843b5a7d7746360f32fc6a6d2e29495/libraries/classes/Controllers/Preferences/ManageController.php#L91 https://github.com/phpmyadmin/phpmyadmin/blob/4471b1bcedf56e4f944544feebc50a3c716a616b/templates/preferences/manage/main.twig#L59

as in Docker & Linux distributions (when installed via packages from distro) the changes need to be made in another file (might have different name, located in different place, such as /etc/phpmyadmin/config.inc.php)

for example, in docker documentation: https://github.com/phpmyadmin/docker#adding-custom-configuration it show usage of file "/etc/phpmyadmin/config.user.inc.php" inside the container which will be used to hold custom configuration, so the running phpmyadmin need to tell users to change this file instead of config.inc.php (otherwise if not mounted directly will lose all changes on container reboot)

emanuelb avatar May 09 '20 10:05 emanuelb

Thank you ! This is similar with the change we do in https://salsa.debian.org/phpmyadmin-team/phpmyadmin/-/blob/master/debian/patches/debian.patch for the Debian package

williamdes avatar May 09 '20 10:05 williamdes

Yes, the needed changes are:

  1. in phpmyadmin codebase, "config.inc.php" string need to exists only in config files (such as vendor_config.php) and in documentation, in all other places it's probably a bug that should be fixed by using value from defined value.
  2. use patched (or supply different) vendor_config.php in docker, which will declare/use the "config.user.inc.php" name as used currently in the documentation.

emanuelb avatar May 09 '20 11:05 emanuelb