{"id":902,"date":"2012-11-15T23:10:49","date_gmt":"2012-11-16T05:10:49","guid":{"rendered":"http:\/\/blog.supportpro.com\/?p=902"},"modified":"2026-02-23T00:27:35","modified_gmt":"2026-02-23T06:27:35","slug":"drupal7-site-loading-with-the-errors","status":"publish","type":"post","link":"https:\/\/www.supportpro.com\/blog\/drupal7-site-loading-with-the-errors\/","title":{"rendered":"How to Fix \u201cini_set() Has Been Disabled for Security Reasons\u201d in Drupal 7"},"content":{"rendered":"\n<p>How to Fix \u201cini_set() Has Been Disabled for Security Reasons\u201d in Drupal 7<\/p>\n\n\n\n<p>When a Drupal 7 website suddenly starts showing warnings like:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Warning: ini_set() has been disabled for security reasons<br>in drupal_environment_initialize()<\/code><\/pre>\n\n\n\n<p>it usually means that your hosting server has disabled the <code>ini_set()<\/code> PHP function at the server level.<\/p>\n\n\n\n<p>This issue commonly appears after:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Server migration<\/li>\n\n\n\n<li>Hosting provider changes<\/li>\n\n\n\n<li><a href=\"https:\/\/www.supportpro.com\/blog\/switching-php-versions-an-overlook\/\" title=\"\">PHP version upgrades<\/a><\/li>\n\n\n\n<li>Security hardening updates<\/li>\n<\/ul>\n\n\n\n<p>Let\u2019s understand why this happens and how to fix it properly.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Why This Error Occurs<\/h2>\n\n\n\n<p>Drupal 7 relies on the PHP function <code>ini_set()<\/code> during its bootstrap process (inside <code>bootstrap.inc<\/code>) to configure runtime settings.<\/p>\n\n\n\n<p>If your hosting provider has disabled <code>ini_set()<\/code> globally in the server configuration (<code>php.ini<\/code> at root level), Drupal cannot modify runtime PHP settings \u2014 and it throws warnings.<\/p>\n\n\n\n<p>This is not a Drupal bug. It is a server configuration restriction.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step-by-Step Fix<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Step 1: Confirm That ini_set() Is Disabled<\/h3>\n\n\n\n<p>Create a simple <code>phpinfo()<\/code> file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php phpinfo(); ?&gt;<\/code><\/pre>\n\n\n\n<p>Search for:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>disable_functions<\/code><\/pre>\n\n\n\n<p>If you see <code>ini_set<\/code> listed there, that confirms the issue.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 2: Create a Custom php.ini File<\/h3>\n\n\n\n<p>Go to your <code>public_html<\/code> directory and create a file named:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>php.ini<\/code><\/pre>\n\n\n\n<p>Add the following line:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>disable_functions =<\/code><\/pre>\n\n\n\n<p>This clears the disabled functions list at the user level.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 3: Update .htaccess File<\/h3>\n\n\n\n<p>Open your <code>.htaccess<\/code> file and add:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>suPHP_ConfigPath \/home\/username\/public_html<\/code><\/pre>\n\n\n\n<p>Replace <code>username<\/code> with your actual cPanel username.<\/p>\n\n\n\n<p>This tells suPHP to use the local <code>php.ini<\/code> instead of the global server configuration.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Important Notes<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>This works only if your server runs <strong>suPHP<\/strong><\/li>\n\n\n\n<li>Some shared hosting providers block overriding disabled functions<\/li>\n\n\n\n<li>On VPS or Dedicated servers, the root configuration must be updated instead<\/li>\n<\/ul>\n\n\n\n<p>If you are using Apache with suPHP, this solution usually resolves the issue immediately.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Alternative Solution (If Above Doesn\u2019t Work)<\/h2>\n\n\n\n<p>If your hosting provider does not allow overriding <code>disable_functions<\/code>, you must:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Contact your hosting provider<\/li>\n\n\n\n<li>Request them to enable <code>ini_set<\/code><\/li>\n\n\n\n<li>Or move to a hosting plan where you control PHP configuration<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Why This Matters for Drupal 7<\/h2>\n\n\n\n<p>Drupal 7 depends heavily on runtime configuration adjustments during bootstrapping.<\/p>\n\n\n\n<p>When <code>ini_set()<\/code> is blocked:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Session handling may fail<\/li>\n\n\n\n<li>Memory limits may not adjust<\/li>\n\n\n\n<li>Error reporting may not initialize properly<\/li>\n<\/ul>\n\n\n\n<p>So this must be resolved for stable operation.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">FAQ Section<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">What does \u201cini_set() has been disabled for security reasons\u201d mean?<\/h2>\n\n\n\n<p>It means the hosting server has restricted the PHP function <code>ini_set()<\/code> in its global configuration to prevent runtime changes for security reasons.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Is disabling ini_set() dangerous?<\/h2>\n\n\n\n<p>Not necessarily. Hosting providers disable it to increase security. However, applications like Drupal 7 require it to function correctly.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Can I fix this on shared hosting?<\/h2>\n\n\n\n<p>Sometimes yes, if suPHP or local php.ini overrides are allowed. Otherwise, you must contact your hosting provider.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u00a0<br>Still Issues? <\/h2>\n\n\n\n<p class=\"has-text-align-center\"><span id=\"hs-cta-wrapper-9d590242-d641-4383-94b4-8cfd62f0af6b\" class=\"hs-cta-wrapper\"><span id=\"hs-cta-9d590242-d641-4383-94b4-8cfd62f0af6b\" class=\"hs-cta-node hs-cta-9d590242-d641-4383-94b4-8cfd62f0af6b\"><a href=\"https:\/\/www.supportpro.com\/freecheckup.php\"><img decoding=\"async\" id=\"hs-cta-img-9d590242-d641-4383-94b4-8cfd62f0af6b\" class=\"hs-cta-img\" style=\"border-width: 0px;\" src=\"https:\/\/no-cache.hubspot.com\/cta\/default\/2725694\/9d590242-d641-4383-94b4-8cfd62f0af6b.png\" alt=\"Server not running properly? Get A FREE Server Checkup By Expert Server Admins - $125 Value\"><\/a><\/span><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>How to Fix \u201cini_set() Has Been Disabled for Security Reasons\u201d in Drupal 7 When a Drupal 7 website suddenly starts showing warnings like: it usually means that your hosting server&hellip;<\/p>\n","protected":false},"author":4,"featured_media":15592,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_lmt_disableupdate":"","_lmt_disable":"","footnotes":""},"categories":[3],"tags":[],"class_list":["post-902","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technical-articles"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts\/902","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/comments?post=902"}],"version-history":[{"count":10,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts\/902\/revisions"}],"predecessor-version":[{"id":15594,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts\/902\/revisions\/15594"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/media\/15592"}],"wp:attachment":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/media?parent=902"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/categories?post=902"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/tags?post=902"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}