$_GET and $_REQUEST causing Internal Server Errors [Fixed]

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

lala
Forum Commoner
Posts: 27
Joined: Mon Jul 26, 2010 7:56 pm

Re: $_GET and $_REQUEST causing Internal Server Errors

Post by lala »

I also have $_GET problem after using php5.3.1, but php 5.0.5 work well.
i have put .php?.. in my code too...( but need add $_GET)
May be you can try to get rid of $_GET in certain php file if you use lower php version like php 5.0

Code: Select all

<?php
        
        echo $hello;
?>
PeteA
Forum Newbie
Posts: 16
Joined: Fri Jul 30, 2010 4:58 pm

Re: $_GET and $_REQUEST causing Internal Server Errors

Post by PeteA »

Fixed,

Right, it was partly the install. They found that the auto installer for the server failed to install the correct files properly.

Next part using the following also sorted the second half of the issue.

Code: Select all

<?
	// Check if variable is in the url and that it is not empty
	if (isset($_GET['var']) && $_GET['var'] != "") {
		$var = $_GET['var'];
	}
?>
For reference, a lot of windows providers seem to globally turn error reporting off, this means it will return an Internal Server Error (500) instead of giving you the error. So the way round this is to use iiset().

Personally I didn't think to use the $_GET inside of the isset() until it was mentioned to me by one of the hosting companies developers who managed to find the problem with the server.
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Re: $_GET and $_REQUEST causing Internal Server Errors

Post by superdezign »

Code: Select all

if (isset($_GET['var']) && $_GET['var'] != "") {
This is equivalent to:

Code: Select all

if (!empty($_GET['var'])) {
PHP's empty() function checks if a variable is not set and, if it is set, it checks if it is empty.
Post Reply