Click to See Complete Forum and Search --> : Premature end of script headers
jcwinnie
09-17-2002, 09:37 PM
Okay, so that can mean anything! Can anybody help a floundering newbie. I am following directions in SAMS Teach Yourself MySQL in 24 Hours. Meloni (2002) writes:
"An easy way to tell if PHP and MySQL are installed and ready for use is to open a text file and put the following line in it and nothing else:
<? phpinfo() ?>" (p. 271)
This test (test.php) results in an internal error message and the Apache error log indicates "Premature end of script headers." :confused:
AMP (Apache / MySQL / PHP) installed by means of PHP Triad on a Windows 98 machine.
Thanks in advance for consideration of my question.
Best regards,
jcwinnie
dotwebbie
09-18-2002, 10:42 AM
<?php
phpinfo();
?>
That and nothing else should work. If not, let me know.
jcwinnie
09-18-2002, 11:30 AM
Nope. I get "Internal Server Error" message.
dotwebbie
09-18-2002, 12:23 PM
Hrm. Okay, which version of php? Which version of apache? Is there a space or carriage return before the <?php in your file?
jcwinnie
09-18-2002, 08:33 PM
I installed AMP from Triad 2.2. I am assuming I have PHP4 and Apache 1.3.
I copied the code from previous message. It appears to be a carriage return.
dotwebbie
09-19-2002, 10:50 AM
Okay.
jcwinnie
09-19-2002, 12:52 PM
I ran a test with a different server (OmniHTTPd Professional). I get a CGI Launch Error when I try to open test.php
I also should mention that PHP is installed as CGI. I have yet to try the SAPI approach.
Feel like I'm hitting my head against a brick wall trying to get PHP to run on Windows 98.
:(
dotwebbie
09-19-2002, 01:07 PM
When you used Apache, was php installed as a cgi or a module? It sounds like a cgi. I don't know why it took me so long to realize that. :( Module is best but if you want to use the cgi, you need to put a shebang line at the top of all of your scripts.
#!C:\path\to\php
Don't put .exe at the end of php.
jcwinnie
09-19-2002, 06:22 PM
I used the PHP Triad Console to install Apache as a service; the test still failed.
I copied the shebang line into test.php; the test failed.
dotwebbie
09-20-2002, 11:37 AM
Hrm . . . What did you do? Here is a full php-cgi script:
#!C:\path\to\php
<?php
print("Hello people.");
?>
jcwinnie
09-20-2002, 01:48 PM
#!C:\path to php
<?php
phpinfo();
?>
dotwebbie
09-20-2002, 02:49 PM
That too. :p
Did it work?
jcwinnie
09-20-2002, 04:12 PM
Nope :rolleyes:
dotwebbie
09-20-2002, 04:40 PM
Hrm . . . This is one of those times when I wish I had access . . . Ah well. So, mod_php is not installed?
jcwinnie
09-20-2002, 04:59 PM
There is no mod_php statement in httpd.conf
dotwebbie
09-20-2002, 05:02 PM
Okay, why not use mod_php?
jcwinnie
09-21-2002, 11:53 AM
Ignorance? :rolleyes:
dotwebbie
09-21-2002, 12:36 PM
Let me know if mod_php gives you the same trouble.
PHP Builder
Copyright Internet.com Inc. All Rights Reserved.