10

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.

Phantom
  • 320
  • 1
  • 5
  • 18
  • Server issues should be asked on serverfault.com. – Marc Delisle Feb 11 '14 at 11:41
  • A "500 Internal Server Error" status code (or a blank page) means that your script is throwing an error but you haven't configured PHP to display error messages. Here's a [brief explanation](http://stackoverflow.com/a/5680885/13508). – Álvaro González Feb 11 '14 at 11:57
  • Have you installed this on a server you can SSH into? Or do you have a control panel like cPanel or similar? You'll need to check the logs (or modify PHP/the script to output errors like @ÁlvaroG.Vicario mentioned above), to find out what the problem is. – aleayr Feb 11 '14 at 12:00
  • @aleayr yes installed it on the server where you can SSH into. I don't have cPanel. Just extracted phpmyadmin files in the folder on the server – Phantom Feb 11 '14 at 12:11
  • 1
    Do you have access to check out the logs for your webserver? If you're running Apache for example, you can try a couple of things: [1] your virtual host for the domain will probably be located at /etc/apache2/sites-available/, or /etc/httpd/sites-available/. Jump into that file and check for an ErrorLog line to see where Apache is logging errors for this domain to. [2] Just try going to /var/log/apache2/error.log (or /var/log/httpd/error.log) and see if you can see the error. Post it back here, and we may be able to help interpret any errors you find in the logs. – aleayr Feb 11 '14 at 12:16
  • I've not given the rights to access these files. Thank you anyways for the help – Phantom Feb 11 '14 at 12:23
  • I'm actually seeing in the logs `libraries/classes/DatabaseInterface.php on line 1544" while reading response header from upstream` after upgrading to 4.8. Double checked permissions but I don't know whats causing it. – Mark Apr 29 '18 at 16:55

6 Answers6

47

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
  • 3
    This did it for me. Thank you. – Jorsh Apr 27 '16 at 04:35
  • 2
    This fixed it for me. It's odd that these packages don't come prebundled with Ubuntu's "LAMP" package ( `sudo apt-get install lamp-server^` ) and do not appear to be mentioned in the phpMyAdmin documentation. – maurice May 04 '16 at 18:02
  • 1
    In Ubuntu 16.04 php 7 is default and this is the solution to fix 500 error. – Evilripper Jul 18 '16 at 08:24
7

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/
Raúl
  • 71
  • 1
  • 3
3

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.

bytepan
  • 361
  • 2
  • 5
2

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.

User Rebo
  • 3,056
  • 25
  • 30
2

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] == ‘*’))

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..

ibondoc22
  • 106
  • 7