3

I have this really wierd question.

When I submit my form, if one of the variables is, say http://www.youtube.com, the page gives a NO DATA RECEIVED error and fails.

Not sure if it is a server setting, or something I can fix in the PHP script.

The post processing script is very simple for testing:

<?php
foreach($_POST as $a=>$b) echo "{$a}={$b}<br />";
?>

This is fine on some servers, not on others, which makes me think it's a server setting.

Any insight will be gratefully received

7
  • What php version do you have ? Commented Aug 2, 2013 at 12:31
  • 2
    can you post your form Commented Aug 2, 2013 at 12:32
  • 1
    Ask your hosting provider. They most like have mod_security or suhosin. Commented Aug 2, 2013 at 12:32
  • It could also be your browser. Chrome is known to have a "NO DATA RECEIVED" problem with certain lines of PHP code Commented Aug 2, 2013 at 12:36
  • Do you have the suhosin patch installed? Commented Aug 2, 2013 at 12:45

1 Answer 1

3

Things to check for in php.ini:

  • post_max_size # should be different from 0
  • variables_order # should be = "EGPCS"
  • max_input_vars # should be higher than the number of variables you pass

Things to check for in the HTML form:

  • the fields and submit button are inside the form
  • the form has method="POST"
  • if the form has files, check the enctype, it should be multipart/form-data, if not it should be application/x-www-form-urlencoded
  • Look for <input type="hidden" name="MAX_FILE_SIZE" value="..." /> - is it big enough ?

If all are fine, check if mod_security is enabled, and also check .htaccess for things like RewriteCond %{REQUEST_METHOD} POST, and the rule after it.

Check if your browser sends the data. In Chrome network tab I see something like this:

enter image description here


You can also try the following:

var_dump(get_defined_vars());

or

$vars = get_defined_vars();
foreach ($vars as $var) {
     echo "<br><b>{$var}</b>";
     var_dump($$var);
}

and check the list of declared variables.

PS:

I presumed that you use Apache, since you didn't include this info. Also, try a different browser, and see if it changes anything.

PS2: I like to check config settings in the command line with:

~$ php -i | grep -i variables_order
variables_order => GPCS => GPCS
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.