I have a PHP script which I'm using in a html form. It works fine in PHP 5.3.3, but not on 5.4.16.
<?PHP
$filename = "/tmp/restart.txt"; #Must CHMOD to 666
$text = $_POST['requester']; # Form must use POST. if it uses GET, use the line below:
$text2 = $_POST['reason']; # Form must use POST. if it uses GET, use the line below:
$fp = fopen ($filename, "w"); # w = write to the file only, create file if it does not exist, discard existing contents
$fp2 = fopen ($filename, "a"); # w = write to the file only, create file if it does not exist, discard existing contents
if ($fp) {
fwrite ($fp, "requester=");
fwrite ($fp2, $text);
fwrite ($fp2, "\nreason=");
fwrite ($fp2, $text2);
fclose ($fp);
sleep(1);
header("Location: }
else {
echo ("ERROR: Please check the status of the app.");
header("Location: }
?>
Form:
<FORM action="restart.php" method="post">
<label for="technician">Requester:</label>
<input type="text" id="requester" name="requester" />
<label for="reason">Reason:</label>
<input type="text" id="reason" name="reason" />
<br><br>
<input type="submit" value="Restart App!">
</form>
Any thoughts on what the issue could be? I'm using the same HTML form on both servers.
<?PHP
$filename = "/tmp/restart.txt"; #Must CHMOD to 666
$text = $_POST['requester']; # Form must use POST. if it uses GET, use the line below:
$text2 = $_POST['reason']; # Form must use POST. if it uses GET, use the line below:
$fp = fopen ($filename, "w"); # w = write to the file only, create file if it does not exist, discard existing contents
$fp2 = fopen ($filename, "a"); # w = write to the file only, create file if it does not exist, discard existing contents
if ($fp) {
fwrite ($fp, "requester=");
fwrite ($fp2, $text);
fwrite ($fp2, "\nreason=");
fwrite ($fp2, $text2);
fclose ($fp);
sleep(1);
header("Location: }
else {
echo ("ERROR: Please check the status of the app.");
header("Location: }
?>
Form:
<FORM action="restart.php" method="post">
<label for="technician">Requester:</label>
<input type="text" id="requester" name="requester" />
<label for="reason">Reason:</label>
<input type="text" id="reason" name="reason" />
<br><br>
<input type="submit" value="Restart App!">
</form>
Any thoughts on what the issue could be? I'm using the same HTML form on both servers.