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:
- ini_set function is present in the disabled functions.
- Mod_security rule is triggered.
- Request exceeded the limit of 10 internal redirects due to probable configuration error.
- Check for any conflicting PHP extensions
How to fix 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. Our Support Engineers 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, Our Engineers 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:
Log in to your server via SSH.
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.
Ref :