cancel
Showing results for 
Search instead for 
Did you mean: 

PHP scripts problem

hobjohns
Dabbler
Posts: 22
Registered: ‎30-07-2007

PHP scripts problem

I'm having trouble running some PHP scripts I've downloaded. The creator believes there's no problem with the scripts, and suggests a server.configuration error. PlusNet Tech Support referred me here. One of the problem scripts called testforphp.php reads
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body>
</body>
</html>
<html>
<head>
<title>PHP test</title>
</head>
<body>
<h1>Does PHP work?</h1>
<?php echo "<h2>Yes, it does.  PHP Version " . phpversion() ."</h2>";
  echo "<p>To run the WXGRAPHIC script, you need GD enabled in PHP.\n";
  echo "<br />Current GD status:</p>\n";
  echo describeGDdyn();
 
// Retrieve information about the currently installed GD library
// script by phpnet at furp dot com (08-Dec-2004 06:59)
//  from the PHP usernotes about gd_info
function describeGDdyn() {
echo "\n<ul><li>GD support: ";
if(function_exists("gd_info")){
  echo "<font color=\"#00ff00\">yes</font>";
  $info = gd_info();
  $keys = array_keys($info);
  for($i=0; $i<count($keys); $i++) {
if(is_bool($info[$keys[$i]])) echo "</li>\n<li>" . $keys[$i] .": " . yesNo($info[$keys[$i]]);
else echo "</li>\n<li>" . $keys[$i] .": " . $info[$keys[$i]];
  }
} else { echo "<font color=\"#ff0000\">NO</font>"; }
echo "</li></ul>";
}
function yesNo($bool){
if($bool) return "<font color=\"#00ff00\"> yes</font>";
else return "<font color=\"#ff0000\"> no</font>";
}
?>
<p>If you don't see "Yes, it does." in large font above, then PHP is not enabled.</p>
</body>
</html>
Each time the script is run it returns
"Server error!
The server encountered an internal error and was unable to complete your request.
Error message:
Premature end of script headers: testforphp.php
If you think this is a server error, please contact the webmaster.
Error 500"
I have other scripts from the same source that are giving the same problem. Can anyone suggest what might be causing the problem?
3 REPLIES 3
Pettitto
Plusnet Alumni (retired)
Plusnet Alumni (retired)
Posts: 6,346
Fixes: 5
Registered: ‎26-11-2011

Re: PHP scripts problem

Hi hobjohns,
Can you please confirm where you are uploading this file to? Are you using the CGI webspace on your account?
If you are nor using this, you may need to activate this <a href="https://portal.plus.net/my.html?IvgvlGnZ6Jm%2FlgSXYspudxGvNgoXUgKqC3f0fFmIgOsmrrsujjYNOs1jIhDFyttD">here</a>
hobjohns
Dabbler
Posts: 22
Registered: ‎30-07-2007

Re: PHP scripts problem

Thanks for the reply.  I'm uploading the php scripts to my CGI webspace.
hobjohns
Dabbler
Posts: 22
Registered: ‎30-07-2007

Re: PHP scripts problem

I've just found the problem - I hadn't realised I needed to change the permissions on the php script. All now working fine.