Menu

#4654 file_get_contents(/usr/share/phpmyadmin/examples/create_tables.sql): failed to open stream: No such file or directory

4.3.2
invalid
nobody
4
2014-12-16
2014-12-16
Alan Parker
No

Note: this is identical to https://sourceforge.net/p/phpmyadmin/bugs/4627/ however that ticket is marked as fixed.

(Re-paste with updated error) Using the tuxpoldo phpmyadmin repo I apt-get updated-ed and got 4.3.2deb0.1, but I also got an error that appears every time I switch databases.

Warning in ./libraries/relation.lib.php#1820
file_get_contents(/usr/share/phpmyadmin/examples/create_tables.sql): failed to open stream: No such file or directory

Backtrace

./libraries/relation.lib.php#1820: file_get_contents(string '/usr/share/phpmyadmin/examples/create_tables.sql')
./libraries/core.lib.php#999: PMA_getDefaultPMATableNames()
./libraries/common.inc.php#1155: PMA_checkAndFixPMATablesInCurrentDb()
./sql.php#14: require_once(./libraries/common.inc.php)

I found /usr/share/doc/phpmyadmin/examples/create_tables.sql.gz and gunzipped it, and basically splattered it into what looked like the right directories across all of the multiple places phpmyadmin likes to hide out in Ubuntu. It still complained.

EDIT: Apologies - despite pasting from the examples, markdown formatting doesn't seem to be working for me.

So I then imported create_tables.sql manually and although it looks like it created all the tables in that sql file, it STILL complains.

Discussion

  • Alan Parker

    Alan Parker - 2014-12-16

    Right, I FINALLY figured it out - the config.inc.php file is giving extremely misleading hard-coded information.

    At around line 28:

                'phpmyadmin: Failed to load ' . $path
                . ' Check group www-data has read access and open_basedir restrictions.'
    

    Anyone using php-fpm concerned at all about security will have separate pools for each site.

    The solution, in MY case was:

    chown -R phpma:phpma /var/lib/phpmyadmin
    chown -R phpma:phpma /etc/phpmyadmin
    chown -R phpma:phpma /usr/share/phpmyadmin

    Therefore, can I strongly suggest that the wording is changed to:

    "Check the webserver has read access to /var/lib/phpmyadmin, /etc/phpmyadmin and /usr/share/phpmyadmin and also open_basedir restrictions".

    Of course, this might vary by repo and OS, but that's at least a bit more generic than assuming everyone is using www-data ?

     
  • Marc Delisle

    Marc Delisle - 2014-12-16

    Alan,
    if you have a look at libraries/Config.class.php in the PMA_Config_fatalErrorHandler() function, you'll see that the error message is not hard coded. We are just showing the result of error_get_last().

     
  • Alan Parker

    Alan Parker - 2014-12-16

    Indeed, but in /etc/phpmyadmin/config.inc.php there is

    if (!function_exists('check_file_access')) {
        function check_file_access($path)
        {
            if (is_readable($path)) {
                return true;
            } else {
                error_log(
                    'phpmyadmin: Failed to load ' . $path
                    . ' Check group www-data has read access and open_basedir restrictions.'
                );
                return false;
            }
        }
    }
    

    However, I notice that at the top, it says:

    • Debian local configuration file

    I'm guessing now that the place I SHOULD be reporting this to is Debian - does anyone have any idea where I start with that? Thanks!

     
  • Marc Delisle

    Marc Delisle - 2014-12-16
    • status: open --> invalid
     
MongoDB Logo MongoDB