Coding⏱️ 3 min read📅 2026-06-19

How to Fix: How to remove error "Warning: ini_set() has been disabled for security reasons", *without* enabling ini_set?

How to remove error "Warning: ini_set() has been disabled for security reasons" without enabling ini_set().

Quick Answer: Try using the `ini_get` function instead of `ini_set` to access configuration settings.

The 'Warning: ini_set() has been disabled for security reasons' error occurs when PHP is unable to set certain configuration variables due to security restrictions. This issue affects users who have enabled the 'Disable Functions' feature in their web server, which restricts the execution of certain PHP functions for added security.

This error can be frustrating for developers and site administrators as it prevents them from accessing certain features or configuring their site properly. However, removing this error without enabling ini_set() is possible through alternative methods.

💡 Why You Are Getting This Error

  • The primary reason for this error is the 'Disable Functions' feature in the web server configuration. When this feature is enabled, PHP restricts the execution of certain functions, including ini_set(), to prevent potential security vulnerabilities.
  • An alternative cause could be a misconfiguration of the CSF (Config Server Firewall) settings, which may be causing the ini_set() function to be disabled for security reasons.

🚀 How to Resolve This Issue

Using the php.ini file

  1. Step 1: Locate the php.ini file on your server, usually located in /etc/php7.x/apache2/php.ini or /usr/local/etc/php.ini. Open this file in a text editor.
  2. Step 2: Find the line that says 'disable_functions' and remove it or set it to an empty string. This will allow PHP to execute the ini_set() function again.
  3. Step 3: Save the changes to the php.ini file and restart your web server for the changes to take effect.

Using a .htaccess file

  1. Step 1: Create a new .htaccess file in the root directory of your Drupal site. If you're using a shared hosting environment, you may need to ask your host for permission to create this file.
  2. Step 2: Add the following line to the .htaccess file: php_value upload_max_filesize unlimited php_value post_max_size unlimited php_value max_execution_time -1 This will allow PHP to execute the ini_set() function again and override any security restrictions set by CSF.

✨ Wrapping Up

By removing or overriding the 'Disable Functions' feature in your web server configuration, you can hide the 'Warning: ini_set() has been disabled for security reasons' error without enabling ini_set(). Remember to restart your web server after making changes to ensure they take effect.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions