newbie with php server error

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
nephish
Forum Newbie
Posts: 10
Joined: Tue Aug 02, 2005 7:23 pm

newbie with php server error

Post by nephish »

Hey there, trying to learn php. sorry for the newbie-ness of this one, but i have a ver simple php script that i cannot get past premature ending of script headers in

Code: Select all

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
 <title>test</title>
</head>
<body>
<?php
  // Hello World in PHP
  echo 'Hello World!';
?>
</body>
</html>
i have tried from the web_root and from cgi-bin , which i really believe to be set up correctly because i have python cgi scripts that work.
just cannot get the php stuff to go. i use debian linux. and i have phpmyadmin installed and it seems to be working fine.

i just dont get it.
what am i doing wrong?
thanks.
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post by shiznatix »

looks just fine to me. what does it output exactally?
nephish
Forum Newbie
Posts: 10
Joined: Tue Aug 02, 2005 7:23 pm

Post by nephish »

from the browser

Code: Select all

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, nephish@xit.net and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.
from the error_log

Code: Select all

[Tue Aug  2 19:55:22 2005] [error] (8)Exec format error: exec of /var/www/me/cgi-bin/testphp.php failed
[Tue Aug  2 19:55:22 2005] [error] [client 63.97.188.161] Premature end of script headers: /var/www/me/cgi-bin/testphp.php
thanks
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

looks like they have a malformed auto-append or auto-prepend setting.. talk to your host..
hansteam
Forum Newbie
Posts: 11
Joined: Tue Aug 02, 2005 2:52 pm
Location: Minnesota

Post by hansteam »

looks like one of two possible problems to me. 1) your server's PHP support is down 2) you need to move your script. If you have a directory "/var/www/me/httpdocs/" try putting it in there.
nephish
Forum Newbie
Posts: 10
Joined: Tue Aug 02, 2005 7:23 pm

Post by nephish »

um..... i am the host.
i am already host a couple of sites that use python in the cgi, but php seems to be not working (except for phpmyadmin)
maybe my server is set up wrong.
thanks
nephish
Forum Newbie
Posts: 10
Joined: Tue Aug 02, 2005 7:23 pm

Post by nephish »

oh, ok. its fixed now.
i had to set up another ScriptAlias in the http.conf so the thing would run from the new cgi-bin that i created .
cool.
thanks for your time, gents
User avatar
bokehman
Forum Regular
Posts: 509
Joined: Wed May 11, 2005 2:33 am
Location: Alicante (Spain)

Post by bokehman »

php scripts should run from root and not need to be in the CGI bin. You must have miss configured it.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

php can be run as a CGI... :roll:
User avatar
bokehman
Forum Regular
Posts: 509
Joined: Wed May 11, 2005 2:33 am
Location: Alicante (Spain)

Post by bokehman »

feyd wrote:php can be run as a CGI... :roll:
Yes but it is certainly not the prefered setup.
Post Reply