PHP Warning: ini_set() has been disabled for security reasons
ERROR :
PHP Warning: ini_set() has been disabled for security reasons
[11-May-2016 20:29:18 UTC] PHP Warning: ini_set() has been disabled for security reasons in /home/user/public_html/administrator/cron.php on line 120
FIX :
How to enable ini_set() serverwide
Your main PHP configuration file might be in /usr/local/lib/php.ini OR /etc/php.ini or it might be in a different location.
Type the below command to check the server php.ini configuration file :
Loaded Configuration File => /etc/php.ini
Main php.ini on my server is in /etc/php.ini. Edit the file /etc/php.ini and remove “ini_set” from disable_functions.
root@server [~]# vi /etc/php.ini
disable_functions = curl_exec,curl_multi_exec,dl,exec,fsockopen,passthru,popen,proc_open,
proc_close,shell_exec,ini_set (Remove ini_set from here and save the file)
Now ini_set is enabled for all domains on the server (ini_set is enabled serverwide)
How to enable ini_set() only for your website
It is possible to enable ini_set only for your website instead of enabling it serverwide. ini_set is disabled on most of the servers for security reasons so it is better to keep it disabled serverwide. Create a custom PHP.ini to enable ini_set() only for your domain.
Copy the main php.ini to the document root of the website.
root@server [~]# cd /home/user/public_html
root@server [~]# cp -a /usr/local/lib/php.ini /home/user/public_html/
root@server [~]# chown user:user php.ini
Now remove “ini_set” from disable_functions. Save the file and exit.
Add the below in the .htaccess file of your website :
suPHP_ConfigPath /home/cpaneluser/public_html/
How to hide ini_set() PHP warning instead of enabling it
Edit the php.ini file of your website and disable PHP warnings for the website.