Page 2 of 3

Re: $_GET and $_REQUEST causing Internal Server Errors

Posted: Sat Jul 31, 2010 11:43 am
by PeteA
Cheers for being a second set of eyes. Yeah the hosting company basically said it was a problem with my code. It's really stupid. Going to see if I can get my money back although I doubt I would.

Oh to have a dedicated server again (well being able to afford one).

Re: $_GET and $_REQUEST causing Internal Server Errors

Posted: Sat Jul 31, 2010 12:28 pm
by jraede
Rackmounted.com had a deal for a while for $50/month for a low-end dedicated...not sure if they still have it but you should check it out.

Re: $_GET and $_REQUEST causing Internal Server Errors

Posted: Sat Jul 31, 2010 2:37 pm
by PeteA
I'm from the UK so low end dedicated's are about £60 ($100ish) a month.

I'll stick with the tried and tested method of "Code and Prey" ie, make it on local and then hope it works everywhere else.

I've only been with that host for 4 days so I'm well within my rights by UK law to cancel. Over here we have something called a 7 day cooling off period which means you can return/cancel contracts within that time.

Re: $_GET and $_REQUEST causing Internal Server Errors

Posted: Sat Jul 31, 2010 3:59 pm
by superdezign
You are using Internet Explorer, aren't you?

IE is famous for it's generic HTTP 500 response. In any other browser, even if it received the HTTP 500 response, it would still show the page if it was provided. The 500 response means that an error occurred, regardless of the severity. In your case, the error is an undefined index. You will see this in your error.log (or error_log.txt, depends on the host) file on the server.

The solution? Fix the problem or tell PHP to stop reporting it. To fix it, always check that a variable has been set before using it with isset() or empty(). To tell PHP to stop reporting it, utilize the error_reporting() function.

Re: $_GET and $_REQUEST causing Internal Server Errors

Posted: Sun Aug 01, 2010 4:10 am
by PeteA
Actually I'm using, Internet Explorer, Chrome, Firefox, Opera and Safari. Happens in all of them.

I've used the following so get shouldnt even be executed and it still errors.

Code: Select all

$var = false;
	if($var == true)
	{
		if(empty($hello){
			$hello = $_GET['hello'];
			echo $hello;
		}
	}
	else echo $var;
The error logs are set to their most basic on the server setup. It shows that an internal 500 has occurred but does not state the cause. Also I cannot use error reporting function because of this issue as no page will be displayed.

Re: $_GET and $_REQUEST causing Internal Server Errors

Posted: Sun Aug 01, 2010 7:50 am
by superdezign
PeteA wrote:I've used the following so get shouldnt even be executed and it still errors.

Code: Select all

$var = false;
	if($var = true)
	{
...
"$var = true" and "$var == true" are not the same thing. You are setting it's value to true, then checking if THAT value is true, which it now is.

Maybe you should refresh your memory on logical operators.

Re: $_GET and $_REQUEST causing Internal Server Errors

Posted: Sun Aug 01, 2010 12:16 pm
by PeteA
typo, and it does't work. I'm just going to wait until tomorrow (monday) and get my money back. Already tested on a few other hosts and not had a single problem. Oh well theres always one.

Re: $_GET and $_REQUEST causing Internal Server Errors

Posted: Sun Aug 01, 2010 3:20 pm
by superdezign
PeteA wrote:

Code: Select all

...
		if(empty($hello){
...
There's also a typo here. But if you're sure it's your host's fault...

Re: $_GET and $_REQUEST causing Internal Server Errors

Posted: Sun Aug 01, 2010 3:49 pm
by PeteA
I retyped it into the browser. Right copy and paste time.

Code: Select all

<?php
	
	$var = 'false';
	
	if($var == 'true')
	{
		if(empty($hello)){
			$hello = $_GET['hello'];
			echo $hello;
		}
	}
	else echo $var;
?>
Still 500, I'm thinking they have something seriously wrong. Just installed joomla and that errors as well, so I'm thinking they have a bad install (not that their willing to do anything about it) or even look at it for that matter.

Re: $_GET and $_REQUEST causing Internal Server Errors

Posted: Sun Aug 01, 2010 3:54 pm
by superdezign
Strange. Maybe it is your host. But, if your website is the only one experiencing this issue, then it could be something else...

Have you looked at the error log file, yet?

Re: $_GET and $_REQUEST causing Internal Server Errors

Posted: Sun Aug 01, 2010 4:12 pm
by PeteA
Yep, as I said in my previous post they're set to their most basic, so all it shows is the page and the error code.

I spoke to someone higher up in the chain a few min ago and have been assured they'll transfer me to a new server and test it before they do.

She did seem pretty knowledgeable and did actually say it might be best to use linux as they've had issue with Windows IIS Servers in the past. Only using one because I need ASP.

Re: $_GET and $_REQUEST causing Internal Server Errors

Posted: Sun Aug 01, 2010 4:17 pm
by superdezign
The error log only shows error codes? And nothing in the error log gives a hint as to what is going wrong? There's no difficulties with .htaccess or with PHP itself?

Re: $_GET and $_REQUEST causing Internal Server Errors

Posted: Sun Aug 01, 2010 4:24 pm
by PeteA
well its windows so there's no htaccess file.

2010-08-01 16:20:58 GET /test.php 500

That's all I get, when I spoke to someone yesterday they said they stripped them down for security reasons. More like saving space, also being on a windows server php errors give 500 instead of line/location/reason.

Re: $_GET and $_REQUEST causing Internal Server Errors

Posted: Sun Aug 01, 2010 4:28 pm
by superdezign
Oh. I totally see what you are talking about.

I'd switch. Firstly, I prefer hosts that trust me with my own debugging information. Secondly, I wouldn't want my site to reside on a Windows server unless it absolutely had to. :P

Re: $_GET and $_REQUEST causing Internal Server Errors

Posted: Sun Aug 01, 2010 4:51 pm
by PeteA
Yeah, I absolutely have to unfortunately (well for this site). Theres some .NET framework that's needed. Personally I could rewrite it in Java in about a week but I'd have to code and maintain it on my own time. Cross ASP and PHP is a pain in the proverbial.

I'm going to see if I can get my money back anyhow.

Cheers for the help, hopefully I'll get to take a look at their PHP ini