I have an website working on Apache 2.4 server and coded with PHP7.
Time to time I can't retrieve any data from $_REQUEST
variable. Its not specific to a page but for all 200+ pages I have in the website, $_REQUEST
variable stops working and whatever I post to the pages get lost. This happens so randomly. Sometimes all ok for a month but sometimes this happens twice a day.
When I restart Apache, problem gets fixed but I try to understand why this happens.
To be able to test it I coded a simple PHP script as below
<html>
<head></head>
<body>
<form action="test.php?GetVar=GetVarExists" method="post">
<input type="hidden" name="PostVar" value="PostVarExists">
<input type="submit">
</form>
<?php
$PostVar=$_REQUEST["PostVar"];
$GetVar=$_REQUEST["GetVar"];
$LocalVar = "LocalVarExists";
echo "PostVar: $PostVar <br>";
echo "GetVar: $GetVar <br>";
echo "LocalVar: $LocalVar <br>";
?>
</body>
</html>`
Normally, page shows the result below when I click submit
PostVar: PostVarExists GetVar: GetVarExists LocalVar: LocalVarExists
When $_REQUEST
stops working randomly, the page show the result below when I click submit
PostVar: GetVar: LocalVar: LocalVarExists
Then I have to restart Apache to get it fixed. I couldn't debug more than that and I'm not an expert for PHP and Apache. I would appreciate if someone give me an idea what could be the problem.
Thanks