As working on my localhost I use variables like $_GET['page'], $_SESSION[userid] etc. But when I use this codes on my web server, it stops executing PHP file in first usage of a variable with aphostrophes (e.g. in index.php file it's $_GET['page']).
I removed all the aphostrophes, (as $_SESSION['userid'] -> $_SESSION[userid]). It worked, but some sessions problems occured.
What is the solution?
The apostrophes should be there, not putting the apostrophes would generate a notice. Appart if you have defined a constant called userid but I doubt.
I think you should check the webserver logs.
Just a guess, in absence of code.
If you say it worked without quotes, then I would assume the variables were mentioned somewhere in double quote context. There the '
will lead to a parsing error:
print " <a href=index.php?page=$_GET['page']>...</a> ";
And on top of that it would be a silent fatal error, as adding error_reporting()
in that very inded.php script would be too late.
Doesn't explain the vague session problem, or why it (supposedly) worked on the test server.