DirectAdmin administrators sometimes encounter a 500 error in the process of accessing PhpMyAdmin from DirectAdmin panel.
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:
#LoadModule security2_module /usr/lib/apache/mod_security2.so
# Default recommended configuration
Another method if we want to keep ModSecurity module loaded to apache is change SecRuleEngine to Off as given below:
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:
./build set use_hostname_for_alias no
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.
./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.