Can’t Save your Theme Options? Tweak your Suhosin Settings

How To

Back in September I released Suffusion Version 3.6.6, where I introduced the capability to skin the navigation bars. To do this I added some nifty constructs that would help skin borders, backgrounds etc. Shortly after that some users (albeit a very small percentage) started reporting an inability to save Theme Skinning options. I tried debugging this, but failed to come up with a solution.

Then, one of Suffusion’s users, “Bird” carried out some terrific voluntary research and found the root cause. Apparently quite a few folks have a protection system called Suhosin installed. To quote “Bird”:

As I had the same issue with Suffusion 3.7.3, I did some research and finally found out that the probelm appears due to ‘php5-suhosin’, a protection system that only allows a maximum of 200 variables per post by default.

In order to check if suhosin is running and might be causing your problems, just create a php-file (e.g. "info.php") with the following content:

<?php phpinfo(); ?>

The variables that are of interest for us and that need to be changed are: "suhosin.post.max_vars" and "suhosin.request.max_vars". Set them both to "500" and the problem should be solved.

What was happening is that the “Theme Skinning” page, thanks to the addition of the new options had a very high number of HTML input fields. Each border / background element / font triggered around 5-6 extra HTML fields, and given the customization choices, the total number of fields multiplied to get to quite a high figure.

The implementation of the fix, though required a little bit more work. And kudos to “Titus”, another user, for the solution. Apparently it is not enough to simply set the above variables to a high figure. You also need to fiddle with a few more. You can set the following values:

suhosin.memory_limit 128M 128M
suhosin.post.max_value_length 65000 65000
suhosin.request.max_value_length 65000 65000

This should take care of the problem. So if you are facing an issue with saving your options, try tweaking the settings as described above. You might need the help of your hosting provider to help set these values.

7 Responses to “Can’t Save your Theme Options? Tweak your Suhosin Settings”

  1. settings are not saved. I’ve been trying to kill the date box to no avail. The above solution does not apply as Suhosin is not installed. Minima theme used because it is the most elegant on the web.

    What still remains is a great theme.

    your captcha is almost impossible to decipher

  2. You can avoid this if you pack all options into one? Aren’t you doing that anyway (I think you do)? I had the same Suhosin issue with Atahualpa.

    By the way: Congrats for a nice theme… and for being a respectful person.

    • Thanks Flynn! As you can guess reading through my posts I am quite in awe of Atahualpa.

      Regarding your question, packing all options into one will not help, because Suhosin deals with post variables. Even if all your options are bundled as one, the number of post variables is still going to be the same, because for each option you will have an input field. To illustrate this with Suffusion, I have had a single array since a very long time, but only when my options increased significantly in a recent release did this start happening. So tweaking Suhosin parameters seems like the only option.

  3. My ISP will not change the settings, is there any other way around this?

    Thanks.

    • Lubna,
      You can still edit your own .htaccess file in your WP installation folder. You can specify the Suhosin parameters there – they should override your ISP’s settings.

      • Thanks allot for your help ..

        I added these lines to my php.ini file:

        suhosin.memory_limit 128M 128M
        suhosin.post.max_value_length 65000 65000
        suhosin.request.max_value_length 65000 65000
        suhosin.post.max_vars 500
        suhosin.request.max_vars 500

        This is my phpinfo() output:
        http://soc.recipes4kidz.com/phpinfo.php

        There’s no trace of Suhosin parameters in the output, yet I still can’t save the ‘Theme skinning’ options.
        I know Suhosin is installed, since I got a warning message about it somewhere on my WP dashboard which I can’t locate again.