Are you stuck with ‘phpMyAdmin ini_set error’?
Often disabling certain PHP functions like ini_get, ini_set, etc. results in phpMyAdmin error. And, when users upload databases via phpMyAdmin, it fails.
At Bobcares, we often get requests from our customers to fix phpMyAdmin ini_set error as part of our Server Management Services.
Today, let’s get into the details on how our Support Engineers fix this error.
What causes phpMyAdmin error ini_set?
Firstly, let’s check on the details of the ini_set function and how it causes errors.
The ini_set() function usually set the value temporarily for executing the current script. Here, the configuration option will keep the new value. The change is only in effect for the current script and will be reverted back when the script ends.
In other words, phpMyAdmin’s working relates to this function setting too.
We also use ini_set for security or optimization. However, developers use ini_set to override some options at runtime which may not be desirable.
The error mainly occurs when server owners add the ini_set() function in the disable_functions directive of the php.ini file.
For instance, the error appeared as follows.
Let’s detail how our Support Engineers help to clear this error.
How to fix phpMyAdmin error ini_set?
At Bobcares, where we have more than a decade of expertise in managing servers, we see many customers face the same problem with PHP.
Now, let’s see the major reason and how our Support Engineers fix this error by editing the variable ini_set.
Altering the PHP settings of a domain counts on the mode in which PHP runs on the server. Therefore, when the customer reports the error, the primary check involves checking the server PHP mode(PHP handler).
Editing the main php.ini
Recently, one of the customers approached us by saying that the user was trying to upload a database backup. But the backup was in .sql format rather than .gz format. So he was trying to restore the backup via phpMyAdmin.
Unfortunately, the user was getting an error saying ‘You have disabled ini_get and/or ini_set in php.ini. This option is incompatible with phpMyAdmin!’.
On further analysis, we could trace that the function ini_set() has been disabled in php.ini caused the problem.
We logged in to the php.ini configuration file and searched for disable_functions items. Here we could see the ini_set() function.
To resolve this problem we have removed ini_set from the list.
1. Initially, we run the following command.
cp -rp /usr/local/lib/php.ini
2. Then we opened the custom PHP file.
3. Thereafter we go to disable_functions directive and then remove ini_set from disabling the function.
4. Finally, we saved and exit.
Then, restarted the Apache service.
service apache2 restart
Editing PHP functions for a domain
In certain cases, due to security reasons, it may not be possible to change PHP settings in the main configuration file. Therefore, our Security Engineers recommend setting per-user restrictions for PHP functions.
Let’s now see how we edit PHP settings for a domain hosted in a SuPHP server. For this, we first set the suPHP path in the .htaccess file.
1. Firstly, we opened the .htaccess file under the public_html folder of the domain.
2. Then we added the following code into it.
suPHP_ConfigPath /home/username/public_html/
Here, we replace the username with the actual domain’s cPanel username. If there is no .htaccess file, then we have to create it and add the same code into it.
Moving on, we make changes in the custom php.ini
1. We create the php.ini file inside your public_html folder or else in the folder where the user has his script.
2. Then we write the following code into this php.ini file.
disable_functions = allow_url_fopen, escapeshellarg, escapeshellcmd, ini_alter, passthru, parse_ini_file, popen, proc_open, proc_close, proc_terminate, proc_get_status, proc_nice, readfile, show_source, system
In case if the disable_functions directive is already present, then we have to add the same code as above.
After enabling the ini_set() function the error disappears and phpMyAdmin starts working.
[Need more help to fix phpMyAdmin ini_set error?- We’re available 24/7.]
Conclusion
In short, the fix for phpMyAdmin ini_set error involves enabling the ini_set function in the PHP configuration file. Today, we saw how our Support Engineers help our customers to fix this problem.
0 Comments