PHP as CGI not working / Premature end of script headers

Volkan Ulukut vulukut at TESCILTURK.COM
Tue Jun 6 04:51:55 EDT 2006


Greetings,

I'm trying to get mapscript working but i get the error that i should run
php as cgi. I followed the instructions on
http://mapserver.gis.umn.edu/cgi-bin/wiki.pl?PHPMapScriptCGI. Since I had
preloaded php as an apache DSO and wish to only run mapscript as a CGI I
added 

Action phtml-script /cgi/php
AddHandler phtml-script .phtml
 
And
 
<Directory /path/to/mapscript/cgi>
      Options ExecCGI FollowSymLinks
 </Directory>
 

To httpd.conf

 

Created cgi directory under mapscript files 

#mkdir cgi
#chgrp nobody ./cgi 
#chmod 750 ./cgi

Then i created a symbolic link into cgi directory 

 

ln -s /usr/local/bin/php /path/to/mapscript/cgi/php 

Then i've restarted apache. And tried to navigate to my test page which is
at /path/to/mapscript/test.phtml

 

It's content is:

<HTML>

<BODY>

 

<?php 

  if (PHP_OS == "WINNT" || PHP_OS == "WIN32")

  {

    dl("php_mapscript.dll");

  }

  else

  {

    dl("php_mapscript.so");

  }

  phpinfo();

?>

 

</BODY>

</HTML>

 

But only thing i get is 500 Internal Server Error. When i check the apache
web logs i see:

Premature end of script headers: /path/to/mapscript/cgi/php

 

I try to run the script on shell using:

/usr/local/bin/php -e /path/to/mapscript/test.phtml

And i get the desired result. 

But on the browser i can't get any output.

 

Any thought about that?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20060606/a2b77317/attachment.html


More information about the mapserver-users mailing list