在某个域上安装phpmyadmin后出现内部服务器错误(HTTP错误500)

时间:2014-02-11 10:51:31

标签: php mysql phpmyadmin

在某个域上安装phpmyadmin后,我收到内部服务器错误(HTTP错误500)。

这是我的 config.inc.php 文件当前读取的内容。

<?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/>.
 */
?>

我需要对此文件进行哪些更改?我已经跟进了各种帖子,但没有帮助。 这是领域失败的问题吗?

提前致谢。

6 个答案:

答案 0 :(得分:39)

如果您使用的是apache2.4和PHP 7,请运行

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

然后重启服务器

sudo service apache2 restart

答案 1 :(得分:6)

我知道已经有几年了,我注意到你的评论仍然没有运气。在这里,我通过apt安装后遇到了同样的500错误。 我查找我的Apache错误日志文件(/var/log/apache2/error.log),并且有以下条目:

[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

它显示找不到库gettext,所以我把它搞砸了:

sudo apt-get install  php-gettext

重新启动Apache:

sudo service apache2 restart

这对我有用。希望能帮助到你。 PS:如果仍然无法正常工作,您可以尝试sym链接该文件夹以防万一:

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

答案 2 :(得分:2)

确保您的PHP版本与Apache2中使用的PHP模块匹配:

   insert into `range`(`product_id`, `range_prices`) VALUES 
    ((SELECT LAST_INSERT_ID() AS id FROM product ), 
(SELECT prices FROM range_and_prices WHERE 
(SELECT total_quantity FROM product WHERE product_id=id) 
BETWEEN ranges_from AND ranges_to ORDER BY prices ASC
    LIMIT 1 ) );

我安装了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 php-mbstring(对于最新的PHP版本也是唯一的),但仍然无法正常工作。至少花了我几个小时,才发现apache自行决定使用哪个PHP版本。

答案 3 :(得分:1)

好的,如果您已经安装了软件包 php-mbstring php-gettext ,但仍然无法使用,请先查看Apache日志:

tail /var/log/apache2/error.log

如果您找到类似的内容:

致命错误:未被捕获的Twig_Error_Syntax:意外的“应用”标签 (期望在第17行附近定义“ if”标签的结束标签)。在 /usr/share/phpmyadmin/templates/columns_definitions/column_virtuality.twig 在第17行

This is a known bug in phpmyadmin 4.9.4

该错误已在phpmyadmin 4.9.5中修复,但是请注意,如果您使用的是Debian 10 Buster,则需要将软件包 php-twig 升级到更高版本,而不是包含的版本。使用Buster或phpmyadmin软件包 在系统升级期间将恢复为4.9.4。

您可以简单地从下一个Debian版本(11,Bullseye)升级php-twig

apt-get install php-twig/bullseye

这对我有用。 希望这不会破坏Deb 10 LAMP设置中的其他功能。

答案 4 :(得分:1)

应用所有上述解决方案后,没有一个对我有用。

这对我有用:

我认为此错误来自phpmyadmin库

因此,我们需要修改以下文件

文件位置:/usr/share/phpmyadmin/libraries/sql.lib.php

行号:614

在ubuntu终端中运行以下命令

sudo nano /usr/share/phpmyadmin/libraries/sql.lib.php 替换两个代码:

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

使用:(count($ analyzed_sql_results [‘select_expr’])== 1)

替换:&&($ analyzed_sql_results [‘select_expr’] [0] ==‘*’)))

使用:&&($ analyzed_sql_results [‘select_expr’] [0] ==‘*’))

答案 5 :(得分:0)

如果要访问从服务器到计算机的mysql数据

你需要改变

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

到您的服务器IP地址。

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

更新

$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';

确保正确设置这些字段..

相关问题