I am trying to bring to life an old website for demonstration purposes. I am stuck with a PHP parse error and I can't find what it's about!
Here is the error I get (apache log) the first time I hit the page:
[error] [client 127.0.0.1] PHP Parse error:
parse error, expecting `T_STRING' or `'('' in .../functions.php on line 4
(the line return is for readability only) I end up with a 500 error.
Here is the only line I get the second time I hit the page:
[notice] child pid 3734 exit signal Segmentation fault (11)
This time I end up with a 324: ERR_EMPTY_RESPONSE
.
Here is the code in the functions.php
file, please don't look at the code it's very old ;).
<?php
// GoTo
function GoTo($page)
{
global $FullPath;
@header('Location:'.$FullPath.$page);
echo "<script language='Javascript'>
window.location='$page';
</script>";
}
Do you see the parse error I am missing??
Why do I get a segfault the second time?
You're using a newer version of PHP than you were when the site first came into existence, and goto
has (sadly) been a keyword since PHP 5.3. Rename your function (:
Do not use goto
as function name.
The goto operator can be used to jump to another section in the program
Change name of the function.
Also keep in mind that you need to exit the script after header('Location: xxx');
and make sure you don't have any output before that header.