简体   繁体   中英

Internal server error (HTTP Error 500) after installing phpmyadmin on a certain domain

I'm getting internal server error (HTTP Error 500) after installing phpmyadmin on a certain domain.

This is what my config.inc.php file currently reads.

<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
 * phpMyAdmin sample configuration, you can use it as base for
 * manual configuration. For easier setup you can use setup/
 *
 * All directives are explained in documentation in the doc/ folder
 * or at <http://docs.phpmyadmin.net/>.
 *
 * @package PhpMyAdmin
 */

/*
 * This is needed for cookie based authentication to encrypt password in
 * cookie
 */
$cfg['blowfish_secret'] = 'a8b7c6d'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
/*
 * Servers configuration
 */
$i = 0;

/*
 * First server
 */
$i++;
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'cookie';
/* Server parameters */
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
/* Select mysql if your server does not have mysqli */
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = false;

/*
 * phpMyAdmin configuration storage settings.
 */

/* User used to manipulate with storage */
// $cfg['Servers'][$i]['controlhost'] = '';
// $cfg['Servers'][$i]['controlport'] = '';
// $cfg['Servers'][$i]['controluser'] = 'pma';
// $cfg['Servers'][$i]['controlpass'] = 'pmapass';

/* Storage database and tables */
// $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
// $cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark';
// $cfg['Servers'][$i]['relation'] = 'pma__relation';
// $cfg['Servers'][$i]['table_info'] = 'pma__table_info';
// $cfg['Servers'][$i]['table_coords'] = 'pma__table_coords';
// $cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages';
// $cfg['Servers'][$i]['column_info'] = 'pma__column_info';
// $cfg['Servers'][$i]['history'] = 'pma__history';
// $cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs';
// $cfg['Servers'][$i]['tracking'] = 'pma__tracking';
// $cfg['Servers'][$i]['designer_coords'] = 'pma__designer_coords';
// $cfg['Servers'][$i]['userconfig'] = 'pma__userconfig';
// $cfg['Servers'][$i]['recent'] = 'pma__recent';
// $cfg['Servers'][$i]['users'] = 'pma__users';
// $cfg['Servers'][$i]['usergroups'] = 'pma__usergroups';
// $cfg['Servers'][$i]['navigationhiding'] = 'pma__navigationhiding';
/* Contrib / Swekey authentication */
// $cfg['Servers'][$i]['auth_swekey_config'] = '/etc/swekey-pma.conf';

/*
 * End of servers configuration
 */

/*
 * Directories for saving/loading files from server
 */
$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';

/**
 * Defines whether a user should be displayed a "show all (records)"
 * button in browse mode or not.
 * default = false
 */
//$cfg['ShowAll'] = true;

/**
 * Number of rows displayed when browsing a result set. If the result
 * set contains more rows, "Previous" and "Next".
 * default = 30
 */
//$cfg['MaxRows'] = 50;

/**
 * disallow editing of binary fields
 * valid values are:
 *   false    allow editing
 *   'blob'   allow editing except for BLOB fields
 *   'noblob' disallow editing except for BLOB fields
 *   'all'    disallow editing
 * default = blob
 */
//$cfg['ProtectBinary'] = 'false';

/**
 * Default language to use, if not browser-defined or user-defined
 * (you find all languages in the locale folder)
 * uncomment the desired line:
 * default = 'en'
 */
//$cfg['DefaultLang'] = 'en';
//$cfg['DefaultLang'] = 'de';

/**
 * default display direction (horizontal|vertical|horizontalflipped)
 */
//$cfg['DefaultDisplay'] = 'vertical';


/**
 * How many columns should be used for table display of a database?
 * (a value larger than 1 results in some information being hidden)
 * default = 1
 */
//$cfg['PropertiesNumColumns'] = 2;

/**
 * Set to true if you want DB-based query history.If false, this utilizes
 * JS-routines to display query history (lost by window close)
 *
 * This requires configuration storage enabled, see above.
 * default = false
 */
//$cfg['QueryHistoryDB'] = true;

/**
 * When using DB-based query history, how many entries should be kept?
 *
 * default = 25
 */
//$cfg['QueryHistoryMax'] = 100;

/**
 * Should error reporting be enabled for JavaScript errors
 *
 * default = 'ask' 
 */
//$cfg['SendErrorReports'] = 'ask';

/*
 * You can find more configuration options in the documentation
 * in the doc/ folder or at <http://docs.phpmyadmin.net/>.
 */
?>

What changes do I need to do on this file? I've already followed up various posts but its not helping. It this the problem with the domain being down?

Thanks in advance.

If you are using apache2.4 and PHP 7, run

sudo apt-get install php-mbstring php7.0-mbstring php-gettext

then restart your server

sudo service apache2 restart

I know it has been a couple of years, and I noticed by your comments that still no luck. Here I run into the same 500 error after installing through apt. I look for my Apache error log file (/var/log/apache2/error.log), and there was the following entry:

[Thu Aug 11 22:38:25.930453 2016] [:error] [pid 18138] [client ::1:35026] PHP Fatal error:  require_once(): Failed opening required '/usr/share/php/php-gettext/gettext.inc' (include_path='.:/usr/share/php') in /usr/share/phpmyadmin/libraries/select_lang.lib.php on line 477

It shows that the library gettext was not found, so I intalled it:

sudo apt-get install  php-gettext

And restarted Apache:

sudo service apache2 restart

That worked for me. Hope it helps. PS: If still not working you may try to sym link the folder just in case:

sudo ln -s /usr/share/phpmyadmin /var/www/

OK, if you have already installed packages php-mbstring and php-gettext and it still doesn't work, first take a look to Apache logs:

tail /var/log/apache2/error.log

If you find something like this:

Fatal error: Uncaught Twig_Error_Syntax: Unexpected "apply" tag (expecting closing tag for the "if" tag defined near line 17). in /usr/share/phpmyadmin/templates/columns_definitions/column_virtuality.twig on line 17

This is a known bug in phpmyadmin 4.9.4

The bug has been fixed in phpmyadmin 4.9.5 but please note that if you are under Debian 10 Buster you will need to upgrade the package php-twig to an higher version rather than the one included with Buster, or package phpmyadmin will be kept back to 4.9.4 during system upgrades.

You can simply upgrade php-twig from next Debian version (11, Bullseye)

apt-get install php-twig/bullseye

This worked for me. Hope this doesn't broke something else in Deb 10 LAMP setup.

Ensure that your PHP version matches the used PHP module in Apache2:

php -v  //PHP 7.4.4 
ls -d /etc/apache2/mods-enabled/php*.conf // php7.3.conf

sudo a2dismod php7.3  // disable 7.3
sudo a2enmod php7.4   // enable 7.4
sudo systemctl restart apache2

I installed the php-mbstring php-gettext (also excplicitly for latest PHP version), but it still wasn't working. At least it took me hours until I noticed apache decides itself what PHP version is used.

After applying all the above mentioned solution, none worked for me.

This worked for me:

I thing this error comes from a phpmyadmin library

So, we need to modify following File

File Location : /usr/share/phpmyadmin/libraries/sql.lib.php

Line No : 614

run following command in ubuntu terminal

sudo nano /usr/share/phpmyadmin/libraries/sql.lib.php Replace two codes :

Replace : (count($analyzed_sql_results['select_expr'] == 1)

With : (count($analyzed_sql_results['select_expr']) == 1)

Replace : && ($analyzed_sql_results['select_expr'][0] == '*')))

With : && ($analyzed_sql_results['select_expr'][0] == '*'))

if you want to access the mysql data from your server to your computer

you need to change

$cfg['Servers'][$i]['host'] = 'localhost';

to you server ip address.

$cfg['Servers'][$i]['host'] = 'your.server.ip.add.here';

update

$cfg['Servers'][$i]['AllowNoPassword'] = true;
$cfg['Servers'][$i]['host'] = 'your.server.ip.add.here';
$cfg['Servers'][$i]['user'] = 'db name here';
$cfg['Servers'][$i]['password'] = 'db password';

make sure that those fields are properly set up..

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM