DirectAdmin PhpMyAdmin error 500 - Fix it Now ?








DirectAdmin administrators sometimes encounter a 500 error in the process of accessing PhpMyAdmin from DirectAdmin panel.

Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to resolve related DirectAdmin errors.

In this context, we shall look into how to fix this DirectAdmin error.


Nature of DirectAdmin PhpMyAdmin error 500

PhpMyAdmin at times returns the error as given below while accessing it from DirectAdmin.

Though it shows the error while accessing PhpMyadmin, MySQL would be running fine on the server.

Also, users would be able to create and delete databases via DirectAdmin control panel.


Some of the top reasons for this error include:

1. ini_set function is present in the disabled functions.

2. Mod_security rule is triggered.

3. Request exceeded the limit of 10 internal redirects due to probable configuration error.

4. Check for any conflicting PHP extensions.


How to resolve DirectAdmin PhpMyAdmin error 500 ?

Before we get into the steps to fix the PhpMyAdmin error, it is important to collect the details of the errors in the logs. We cross-check the apache error log initially for errors. 

This can be in /var/log/httpd/error_log or /var/log/httpd/domains/domain.com.error.log.

Next, they turn on "display_errors" in config.php file under phpmyadmin folder.


1. Remove ini_set function from disable_functions in php.ini

By default, each server has a set of functions declared in the disabled functions list in php.ini. This feature is to disable the execution of dangerous functions in the server.

For instance, we have noticed a few of these cases where the ini_set function is disabled in the php.ini file and it triggers the error with PHPMyAdmin.

Removing it from the disable_function list fixes the issue.


2. Modsecurity Rules

Another common reason for this error would be ModSecurity rule.

By default custombuild installation, mod_security rules are installed in /etc/modsecurity.d/

Apache load's ModSecurity modules and configuration in/etc/httpd/conf/extra/httpd-modsecurity.conf.

In reality, the easiest way to disable Modsecurity is to disable apache to load ModSecurity module in https-modsecurity.conf file. Just add #comment’s to begin LoadModule directive:

httpd-modsecurity.conf
LoadFile /usr/local/lib/libxml2.so
#LoadModule security2_module /usr/lib/apache/mod_security2.so
<ifmodule mod_security2.c>
# Default recommended configuration
SecRuleEngine On
SecRequestBodyAccess On
.
.
.
</ifmodule>

Another method if we want to keep ModSecurity module loaded to apache is change SecRuleEngine to Off as given below:

SecRuleEngine Off

Then restart the web service.


3. Update and rebuild DirectAdmin

Sometimes, updating and rebuilding DirectAdmin fixes this error with the PHPMyAdmin. This can be done with the series commands below:

cd /usr/local/directadmin/custombuild
./build update
./build set use_hostname_for_alias no
./build rewrite_confs

 

4. Disable conflicting PHP extensions.

Often, the PHPMyAdmin error could also be related to some PHP extensions. For instance, we recently handled a support request where the uploadprogress extension was triggering the error.

To disable a php extension in DirectAdmin follow the series of steps below:

i. Log in to your server via SSH.

ii. Change directory to custombuild and run an update.

cd /usr/local/directadmin/custombuild
./build update 
./build set_php extension_name no

We can verify the extensions either by using command "php -m" from command line or by using php.info page.


[Need urgent assistance in fixing DirectAdmin errors? – We're available 24*7. ]



Conclusion

This article covers methods to resolve DirectAdmin PhpMyAdmin error 500. This error happens as a result of a number of reasons that include PHP settings, modsecurity rules and so on.


To resolve this error, In the library is /usr/share/phpmyadmin/libraries/sql.lib.php,

You need to modify the file:

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

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


For Linux Tutorials

We create Linux HowTos and Tutorials for Sys Admins. Visit us on LinuxAPT.com

Also for Tech related tips, Visit forum.outsourcepath.com or General Technical tips on www.outsourcepath.com