Jump to content

Replaced php and get HTTP 500 internel server error


Chrisj

Recommended Posts

I replaced a working file, with the same file from another working web site, but the new file generates a HTTP 500 internal server error page.

 

The only difference in the new page are these lines:

///////////////////////////////////////////////////
$_SESSION['searched'] = $_GET['keyword'];
$prch = $_GET['p'];
if ($user_id == "") {
$new_temp = "themes/$user_theme/search_results1.htm";
}elseif ($prch == "1") {
$new_temp = "themes/$user_theme/search_results2.htm";
}else{
$new_temp = "themes/$user_theme/search_results.htm";
}

I'm hoping to learn the reason why these lines might be creating this error.

Thanks

Link to comment
Share on other sites

the most common reasons for a http 500 error from a .php script is a fatal parse error or a fatal runtime error and php's error_reporting/display_errors are not turned on.

 

just the snippet of code you posted does not produce a fatal php error, though you may have introduced such an error depending on where and how you inserted those lines into the file and something that is dependent on the result from those lines might produce a fatal runtime error if data values are missing/wrong variables...

 

you need to set php's error_reporting to E_ALL and either set display_errors to ON or set log_errors to ON in your php.ini (for a fatal parse error you cannot set them in your code because your code never runs) to find out what if any php detected errors there are.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.