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

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.