954,574 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Error 500 with IE but not with FF or Safari

Hi,
I get an error 500 when I try to open my web page with IE, but not with other Programs as Firefox or Safari. The problem I think is with the redirect in the index.php file, but I don't see the problem.
Here is the code:

<?
fcnX('home.php');


And the function is a Java script:

}
function fcnX($prUrl){
  echo '<script language="javascript">' . "\n";
  echo '<!--' . "\n";
  echo 'document.location = \'' . $prUrl . '\';' . "\n";
  echo '-->' . "\n";
  echo '</script>' . "\n";
  break;
  exit;
}


Any ideas?
Thks!

julio gomez
Newbie Poster
13 posts since Jun 2009
Reputation Points: 10
Solved Threads: 0
 

Hi there,
The problem is that you are calling javascript from inside your php which is outside of it's name space. What you gotta do is in your php file : echo ""; in the middle of your head section and the function will automatically be called when the page loads.

Menster
Junior Poster
175 posts since Jun 2009
Reputation Points: 49
Solved Threads: 22
 

Thanks, but I dosen't seem to work either.
The strange thing is that the function as originally posted works fine in FF and Safari but not in IE. It is also strange that it works fine with IE in my local server but not in the remote server, can it be something to do with the server config??

julio gomez
Newbie Poster
13 posts since Jun 2009
Reputation Points: 10
Solved Threads: 0
 

Why are you using javascript to redirect?

Just use header('Location: http://somesite.com/page.html'); . You can use a relative url as well. Make sure you have nothing being echoed to the browser before calling that.

If you are still getting an internal server error, post more code because that function will not cause that.

kkeith29
Nearly a Posting Virtuoso
1,357 posts since Jun 2007
Reputation Points: 235
Solved Threads: 194
 

Thanks, that works but I don't want to change the function because it is used several times, it works fine using a "direct" redirect. It can be Plan "B".
But I want to know why is this happening because it might be something with the config of the server I am using because it works fine in other servers. I am concern that the config of the server might be affecting other functions as well.

julio gomez
Newbie Poster
13 posts since Jun 2009
Reputation Points: 10
Solved Threads: 0
 

Why do you have break; in the function? You don't have a control structure that accepts that.

kkeith29
Nearly a Posting Virtuoso
1,357 posts since Jun 2007
Reputation Points: 235
Solved Threads: 194
 

Hi,
When you use a cable modem or a DSL connection to try to connect to a Microsoft Internet Information Services (IIS) site that is running on a Microsoft Windows 2000 Professional-based computer, you may receive the following error message in Microsoft Internet Explorer:

Error 500

If you click to clear the Show friendly HTTP error messages in the Internet Options dialog box in Internet Explorer, and then you try to connect to the same site over the same connection, you may receive one of the following messages in Internet Explorer:
Bad Url
Bad Gateway

Note To locate the Show friendly HTTP error messages check box, click Tools, click Internet Options, and then click the Advanced tab.

emarshah
Junior Poster in Training
61 posts since Jan 2008
Reputation Points: 10
Solved Threads: 6
 

Hi, I get an error 500 when I try to open my web page with IE, but not with other Programs as Firefox or Safari. The problem I think is with the redirect in the index.php file, but I don't see the problem. Here is the code:

<?
fcnX('home.php');

And the function is a Java script:

}
function fcnX($prUrl){
  echo '<script language="javascript">' . "\n";
  echo '<!--' . "\n";
  echo 'document.location = \'' . $prUrl . '\';' . "\n";
  echo '-->' . "\n";
  echo '</script>' . "\n";
  break;
  exit;
}

Any ideas? Thks!


Well perhaps you may need to specify the full url in the function instead of just a page name. Below is an example of how you should use your function:

<?
fcnX('http://www.example.com/blogs/home.php');

You may find that IE is just getting confused without the full address.

cwarn23
Occupation: Genius
Team Colleague
3,033 posts since Sep 2007
Reputation Points: 413
Solved Threads: 259
 

Thank you all,
Problem solved, what I did was to change the function, eliminate the javascript and make a more direct:

function fcnX($prUrl)
{
   header('Location: '.$prUrl);
  exit();
}


I was so frustrated trying to understand why it wasn't working in IE that I didn't paid attention to more simple solutions.

Thanks again

julio gomez
Newbie Poster
13 posts since Jun 2009
Reputation Points: 10
Solved Threads: 0
 

Hi, i am KEN74 from .

The problem is in the break, it may work in some browsers, but ie have a problem with the break, if you use it outside a loop.

Remove the break , and your code will work right

Feel free to contact me if you need Non-Object PHP help.


POSTDATA : I know this post is old, but maybe this helps someone, that has this break problem.

Good luck ;)

KEN74
Newbie Poster
1 post since Oct 2011
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You