473,396 Members | 1,916 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

"Premature end of script headers: php.cgi"

I have compiled PHP 5.2.3 as a CGI binary, and this works. I can, for example,
do the following:

$ php.cgi hello_world.php
X-Powered-By: PHP/5.2.3
Content-type: text/html

Hello World!

===

However, this completely fails when I attempt to route PHP scripts through this
new CGI executable with .htaccess. My approach is this:

File: doc_root/.htaccess
AddHandler phpFive .php
Action phpFive /php.cgi

(doc_root/php.cgi links to the correct executable)

Any PHP page I visit in my browser now returns a 500 error, and the error log
contains this:

Premature end of script headers: php.cgi

It's clearly not the fault of the PHP executable itself, since it works from the
command line.

===

I have also tried renaming the link so it no longer has a .cgi extension.
Instead, I now get the following errors on all PHP pages.

Warning: Unexpected character in input: ' in php-cgi on line 571
Warning: Unexpected character in input: ' in php-cgi on line 571
Parse error: syntax error, unexpected ',' in php-cgi on line 571

At a wild guess, I'd say that the problem is that the server tries to interpret
the PHP executable rather than execute it as a native binary. Any ideas how I
can stop that?

--
cb
Aug 1 '07 #1
1 7226
Apparently, cgi WILL NOT resolve symbolic links to the binary itself
(though directory links are resolved).

What does this mean?

The symbolic link chain that connects DOC_ROOT/cgi-bin/php.cgi to
/MY_SOFTWARE/php/php-cgi can pass through as many links and directories
as you want, but it may only link to the parent directory that contains
the actual php.cgi file.

It /cannot/ link directly to the executable.

I hope that this helps anyone else who may have had this problem.

--
Christoph Burschka
Aug 1 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Seagull Manager | last post by:
Running Apache 1.3, PHP 4.3, and WinXP, configured acc. to instructions on apache manual and php manual (as far as I can see), but getting "internal server error" in browser... log says "Premature...
4
by: Q | last post by:
Hello, I have composed the following simple php file: <html> <head><title> Title. </title></head> <body> <?php header("Location: http://www.something.com/tmp2.php"); ?> </body>
1
by: Wet Basement | last post by:
I am passing data to a putcart.pl , parsing it, then building the query string to put the item in the shopping cart: $cartStr =...
0
by: Ian Staines | last post by:
In asp the following code: Request.Servervarables("AUTH_USER") will return the header variable AUTH_USER In .NET the code Request.Servervariables("AUTH_USER") returns the server variable...
10
by: Luke Meyers | last post by:
So, just a little while ago I had this flash of insight. It occurred to me that, while of course in general there are very good reasons for the conventional two-file header/implementation...
0
by: phpCodeHead | last post by:
Hello all, Given the following code: $FormSubmittedUserData = "John Doe <jdoe@somedomain.yuk>"; $to = 'myemail@emaildomain.nuts'; $subject = 'This is my subject'; $message = 'This is my...
3
by: shybe | last post by:
Ok, Im trying to create a "send this article to a friend" script for my blog, Right now its sending all the articles, but I want it to only send the article in which the form is attached...
0
by: tibor | last post by:
Hi, I need to call a CGI script which should be a web service from .NET environment. I got an example in perl but I'm unable to trasform it into .NET (C#). Can anybody help me with this? use...
3
by: GazK | last post by:
I have been using an xml parsing script to parse a number of rss feeds and return relevant results to a database. The script has worked well for a couple of years, despite having very crude...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.