[DebianGIS-dev] Bug#447814: php5-mapscript extension does not work with PHP in CGI/FCGI or CLI modes

Steven Monai stevem.spatialmapping.com at gmail.com
Tue Oct 23 22:03:57 UTC 2007


Package: php5-mapscript
Version: 5.0.0-2

The PHP5 MapScript extension (from the UMN MapServer project) does not
work when PHP5 is running in either CGI/FCGI or CLI modes. For
example, when trying to use the MapScript extension in a PHP5 script
run from the command line, the following error message is emitted at
the point where the extension is loaded via the PHP dl() function:

"This build of mapscript can't be load as a 'cli' module for stability
reason, but only with php as an apache DSO."

Examining the Debian MapServer package source, I see this bug is
caused by a specific patch in the Debian build for the php5-mapscript
package. The patch, named 20_php_build.dpatch, inserts a check in the
startup code for the PHP/MapScript extension. The inserted code checks
the sapi_module name, and if it is 'cli', 'cgi', or 'cgi-fcgi', the
extension emits the above error message, and exits.

I do not believe there is any good reason to forbid the use of the
PHP/MapScript extension in CGI/FCGI or CLI modes. In fact, to the
contrary, the official MapServer documentation recommends running
PHP/MapScript in CGI mode, in preference to DSO. See:
http://mapserver.gis.umn.edu/docs/howto/phpmapscript-install

Specifically, the following FAQ appears there:
Q: Does PHP/Mapscript have to be setup as a CGI? If so, why?
A: Yes, please see the PHP/Mapscript CGI page in the Mapserver Wiki for details.

I feel that the simplest and best remedy for this bug is to remove the
above patch (20_php_build.dpatch) from the MapServer package source.
Furthermore, the package comments should mention that PHP/MapScript is
recommended to be run in PHP as CGI, and possibly even warn users that
there could be instability issues when run in PHP as an Apache DSO.

[Note that I have also submitted this bug to the Ubuntu bug tracker. (See:
https://bugs.launchpad.net/ubuntu/+source/mapserver/+bug/130304)]





More information about the Pkg-grass-devel mailing list