Premature end of script headers: php

Donald Harter harterc1 at COMCAST.NET
Mon Jun 27 20:08:57 EDT 2005


On Wed, 29 Dec 2004 11:33:11 -0500, Jeff Portwine <jdport at VERITIME.COM> wrote:

>
>Premature end of script headers: php
>
>Has anybody come across this error before, or have any suggestions on what
>it could mean or how to resolve it?    PHP definately works otherwise...
>
>Thanks for any suggestions.
>
>Regards,
>Jeff

I have been having this problem today.  I had my mapserv wroking and decided
to rebuild some of the dependent programs such as apache, php and postgres.

For a while I got the following message:

 [Mon Jun 27 12:23:01 2005] [error] PHP Warning:  dl(): MapScript: Unable to
initialize module\nModule compiled with module API=20020429, de
bug=0, thread-safety=0\nPHP    compiled with module API=20020429, debug=1,
thread-safety=0\nThese options need to match\n in /var/www/html/
test_mapserv.php on line 11

I fixced this by recompiling php and mapserv without the debug options.  It
seems that they did not see a match even though both were compiled with debug.

Then I got these errors:
[Mon Jun 27 18:07:17 2005] [error] [client 127.0.0.1] Premature end of
script headers: /var/www/cgi-bin/mapserv
[Mon Jun 27 18:08:17 2005] [error] [client 127.0.0.1] Premature end of
script headers: /var/www/cgi-bin/php

Each corresponds to the mapscript cgi program and php_mapscript.so
I finally was able to get my cgi mapscript working again.  All I had to do
was recompile without this option "--with-php=/ext2e/php-4.3.11". I don't
have a mapscript version, but my cgi mapscript works again.  It seems that
when this option gets selected, it corrupts the build of the cgi mapscript.
 At one time I had both of them working.  I have found conflicting
information on how to build PHP for mapscript. One says not to build it as a
dynamic module.  Another person said he built it with the
"--with-apxs=/usr/local/apache/bin/apxs " option.  Yet with that option PHP
is not built as a standalone cgi program according to another person.

Here is what versions I am using and thier configure options:
mapserver-4.4.2
  $ ./configure --with-freetype=/usr/bin --with-png --with-jpeg --with-gd
--with-proj --with-gdal=/usr/local/bin/gdal-config --with-postgis
=/usr/local/pqsql/bin --with-xpm=/usr/X11R6/lib

There is an error in the makefile that is generated with the postgis option.
   It generates a sole "-I" as a command line option. Also I had to add
"-I/usr/local/pgsql/include" so that it could find some include files.


postgresql-8.0.3
./configure -with-ssl

php-4.3.11
./configure  --without-mysql --with-pgsql -enable-force-cgi-redirect
--with-cgi --without-debug

apache_1.3.33
CFLAGS="-g" \
./configure \
"--with-layout=RedHat" \
"--enable-module=so" \

I would like to get my mapscript working again.
I would appreciate any suggestions on how to get it working.
Also I am looking for some techniques on how to troubleshoot/debug this.
Before I took out the --with-php option in the mapserv config, I put a sleep
statement in the main routine, and tried a printf statement.  I then tried
to attach the process using gdb.  I wasn't able to trace the flow since it
seemed to crash soon after and I could not get to a break point.

Here is what I got for that:
(gdb) step
Single stepping until exit from function sleep,
which has no line number information.
0x0805109e in main ()
(gdb)
Single stepping until exit from function main,
which has no line number information.

Program received signal SIGSEGV, Segmentation fault.
0x42080f40 in strncpy () from /lib/i686/libc.so.6
(gdb) bt
#0  0x42080f40 in strncpy () from /lib/i686/libc.so.6
#1  0x0807e9a9 in msSetError ()

Perhaps If I had a suitable input file I could do something like this:

"gdb mapserv <inputfile"  Mapserv complains if it is executed on a command
line.  Something similar could be done for php with php_mapscript.so.  Then
perhaps someone could find out what is going on.



More information about the mapserver-users mailing list