PHP returns 500 error when having too many $_POST variables

282 Views Asked by At

I have a php page in my vps which expects 46 $_POST variables.
Whenever I try to address it, it returns a 500 Internal Server Error response.
When I delete 8+ $_POST variables from the file, everything works as expected.
I have alraedy tried setting the max_input_vars to 3000 in the php.ini (and restarting the server afterwards).
I have also tried changing the .htaccess file, nothing worked.
Any suggestions ?
Thanks in advance.

Edit :
The error log :

[Fri Dec 23 17:51:22.902648 2016] [:error] [pid 27211] [client 77.138.82.103:54270] PHP Parse error:  syntax error, unexpected '$Phase_3_Q_Before' (T_VARIABLE) in /var/www/html/server/addSwitch.php on line 43
[Fri Dec 23 17:51:24.215003 2016] [:error] [pid 27212] [client 77.138.82.103:54271] PHP Parse error:  syntax error, unexpected '$Phase_3_Q_Before' (T_VARIABLE) in /var/www/html/server/addSwitch.php on line 43
[Fri Dec 23 17:51:25.806288 2016] [:error] [pid 27213] [client 77.138.82.103:54280] PHP Parse error:  syntax error, unexpected '$Phase_3_Q_Before' (T_VARIABLE) in /var/www/html/server/addSwitch.php on line 43
[Fri Dec 23 17:51:27.587422 2016] [:error] [pid 27210] [client 77.138.82.103:54302] PHP Warning:  phpinfo(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /var/www/html/info.php on line 2
[Fri Dec 23 17:51:34.500954 2016] [:error] [pid 27212] [client 77.138.82.103:54350] PHP Parse error:  syntax error, unexpected '$Phase_3_Q_Before' (T_VARIABLE) in /var/www/html/server/addSwitch.php on line 43
[Fri Dec 23 17:51:39.513983 2016] [:error] [pid 27260] [client 77.138.82.103:54351] PHP Parse error:  syntax error, unexpected '$Phase_3_Q_Before' (T_VARIABLE) in /var/www/html/server/addSwitch.php on line 43

Part of the code :

$Phase_3_U_Before = $_POST['Phase_3_U_Before'];
$Phase_3_I_Before = $_POST['Phase_3_I_Before'];
$Phase_3_P_Before = $_POST['Phase_3_P_Before'];
$Phase_3_S_Before = $_POST['Phase_3_S_Before'];
$Phase_3_Q_Before = $_POST['Phase_3_Q_Before'];
$Phase_3_cos_Before = $_POST['Phase_3_cos_Before'];
$Phase_3_U_After = $_POST['Phase_3_U_After'];
$Phase_3_I_After = $_POST['Phase_3_I_After'];
$Phase_3_P_After = $_POST['Phase_3_P_After'];
$Phase_3_S_After = $_POST['Phase_3_S_After'];
$Phase_3_Q_After = $_POST['Phase_3_Q_After'];
$Phase_3_cos_After = $_POST['Phase_3_cos_After'];
1

There are 1 best solutions below

7
On

Have you increased the upload sizes?

upload_max_filesize = 10M
post_max_size = 10M

Did you check the errors?

display_errors = 1
display_startup_errors = 1
error_reporting = E_ALL

(add all of these to your php.ini)