ArtsAutosBooksBusinessEducationEntertainmentFamilyFashionFoodGamesGenderHealthHolidaysHomeHubPagesPersonal FinancePetsPoliticsReligionSportsTechnologyTravel
  • »
  • Technology»
  • Computers & Software

PHP Ini Set Error: How to Fix "Warning: ini_set() has been disabled for security reasons" Error

Updated on August 8, 2010

The Problem

I recently installed Drupal on my new website. I used the Fantastico installer on my cPanel so it should have been easy, right? Imagine my surprise when I loaded the front page of my website and saw a whole page of error messages!

After much research, I was able to get the problem fixed... well, patched at least. I am not a master programmer by any stretch of the imagination, so don't get mad at me if this doesn't work for you. It worked for me, and I am passing it on in case it can help someone else.

From the information I found during my research, it appears that these errors are caused by a security setting on the web host's site. Since I can't change their settings, the solution was to comment out the lines that caused error messages. This article will explain how to do that.

The Solution

Before you get started, look at the error messages you are getting on your website. They will contain the path and file name of the file where the error is occurring. They also tell you which line of the file the error occurs in.

Now that you know which file is causing the problem, log into the control panel of your website and navigate to the offending file. You will need to open it for editing. If you have the option of opening in a code editor, choose that option.

Now scroll down to the offending line or lines. In my case, there were several lines all together that were causing errors. To comment out a large group of lines, you can do the following:

1) Add /** in the line before the error. This needs to be in a line all by itself, so if there is something in the line above, add a blank line and then type /** in it.

2) Add * before each line that is causing an error message.

3) Add */ in a blank line following the offending lines.

All Done!

 

Look at the picture above to see how the commented lines should look.

If you have a single line by itself that is causing an error, you can comment that line by itself by adding // at the beginning of the line.

After commenting out the group of errors shown in the settings.php file, I still had about half a dozen error messages. I next commented out the single line that was causing an error in bootstrap.inc (line 342). After that, the rest of the error messages went away.

Now, I can't promise that commenting these lines out won't cause problems down the road, but if it does, I'll try to post an article telling you how to fix those too.

Comments

    0 of 8192 characters used
    Post Comment

    • profile image

      sonofzell 4 years ago

      Many thanks!!

    • profile image

      MasviL 5 years ago

      You are the woman! Thanks A LOT.

    • profile image

      vipi 5 years ago

      thnxxx alottt.. :)

    • profile image

      ravi 5 years ago

      thank you very much. my bookmarking site http://www.thefunbooster.com/bookmarks was showing error in 9th line.Now it is all right.thanks for your suggestion

    • profile image

      Matt D 5 years ago

      Fantastic!! worked like a charm.

    • profile image

      Air Supply 5 years ago

      also work on my clipbucket.. Thank you

    • profile image

      Andrew 7 years ago

      Many thanks, worked a treat !

    • profile image

      Mandy 8 years ago

      Oh my if i could kiss you i would. I have 5 different domains on the same hosting company. They changed their security protocol and i had the same ini_set error on all pages. I've been searching for a fix any kinda of fix for weeks now, and i stumbled onto this page, and your little trick worked, and worked perfectly. Again thank you!!

      Hugs

      Mandy