Switched to PHP 5, form $_POST variables don’t work; solution: turn off mod_bandwidth

First published on October 20, 2007

Recently, I switched web hosts for this blog. The new server has both PHP 4 and PHP 5 installed, with PHP 4 running by default. I’ve had some painful experiences in the past where web hosts upgraded to PHP 5 without telling clients, but now I am fully convinced that PHP 5 is the way to go. Unfortunately, when I enabled PHP 5 on the server, things weren’t as peachy as I would have liked:

  • The blog displayed properly, but whenever someone posted a comment, they would get a blank page.
  • Whenever I tried to log in to the WordPress admin interface, the login page would simply reload.
  • I created a simple form that submitted to itself and I discovered (using print_r($_POST)) that $_POST variables weren’t being sent.

All of the above worked fine with PHP 4… so I went back and forth with the nice support people, trying to figure out the problem. I found some other reports that sounded similar to my situation, but they never posted a solution!

Eventually, the technical support guy switched off mod_bandwidth in the Apache configuration file and now everything works magically again :D PHP 5 it is!

I don’t really know what mod_bandwidth does (maybe it was actually a problem with memory limits?), but if you are having a similar problem, try looking there…


8 Responses to “Switched to PHP 5, form $_POST variables don’t work; solution: turn off mod_bandwidth”

  1. Roland says:

    Just re-compiling Apache now with mod_bandwidth turned off . I have been having the same problem, thought it was php4/php5 issues, then I thought it was globals and long arrays (because I was running OSCommerce and these are common issues) and I also thought it was because I had some old http_post_vars entries. At the end of the day, it’s become clear it is a configuration issue and this fixed it.

    For others looking for this issue: php.ini, php config, WHM

  2. MT says:

    Thanks, that rescued me :)

  3. Colin says:

    You can still pass variables on most hosts with php5 if you use a code like:


    at the top of the page that you are sending a form to.

    (ie so you can still put $YOURVARIABLE anywhere in the second page like with php3)

  4. Amod says:


    I am facing same problem. I am using PHP5.2.8, Apache 2.2.

    phpinfo() is working fine.

    In my configuration file, there is no entry for mod_bandwidth!

    Any comments would be highly appreciated!


  5. Eva says:

    Having the same problem. I told the service people about it, havent got a reply yet. I hope they can fix it because using $_request doesn’t seem to be the way to go.

  6. gl says:

    Colin hints at it above there is a change in predefined variables with PHP 4.2.0 and above:

    Make sure you look at the superglobals link as it gives the comprehensive list of the the new way to call the old variables (like $_POST)

  7. Dave Ehrlich says:

    Found a different answer to this problem.
    The Problem: hosting made a change to my account in a .htaccess file with the following line: "AddHandler x-mapp-php5 .php". I assume this changed the interpreter for my php program. And so the problem begins…

    All of a sudden my software which referenced variables pass via forms as $var1, $var2, and so on, didn’t work. This was true if I used the post or get method to pass variables. My focus was only on the Post method for my programs, so I did a print_r($_Post) and found the variable in the array, and could access them using the $_Post(var) method, but again not the $variable method.

    1st Issue Solution.
    1and1 sent me an link which addressed this issue. Example #2 Accessing data from a simple POST HTML form. This is the relevent excerpt from the link; followed by the actual link if you want more detail. Look at paragraph 3 .. I marked it for you.:
    // Available since PHP 4.1.0

    echo $_POST['username'];
    echo $_REQUEST['username'];

    import_request_variables(‘p’, ‘p_’);
    echo $p_username;

    // Unavailable since PHP 6. As of PHP 5.0.0, these long predefined
    // variables can be disabled with the register_long_arrays directive.

    echo $HTTP_POST_VARS['username'];

    // Available if the PHP directive register_globals = on. As of *** Patagraph 3***
    // PHP 4.2.0 the default value of register_globals = off.
    // Using/relying on this method is not preferred.

    echo $username;
    The linke for this aritcle is:

    We wound up putting the following line in my php.ini file:
    register_globals = on. And the problem was solved.
    According to 1and1, The php.ini file should go in your root directory.

    Hope this helps: – Dave Ehrlich [email protected]

  8. Lou says:

    I went crazy for the last 2 days. All I did was backup a DBs tables and data and restore them to a different account on the same host. I selected PHP 5. After the restore, none of my files would run. I would get mysql_numrow_count errors on every select. Before the backup and restore, none of the code needed the ‘$var=($_post/get[name]) command. Once I added that command, everything ran fine. Do you think the mod_bandwidth switch was the culprit in this instance?

    Reply from Peter: Sounds like register_globals was on and is now off (which is recommended). For security reasons, it is best to specify POST and GET variables as it seems to be now forcing you to do.

Speak your mind

To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word