mapscript installation on debian

Lehuta Juraj - OZ Juraj.Lehuta at SVP.SK
Thu Mar 24 08:56:35 EST 2005


 Thank you.

wochter


-----Original Message-----
From: James Cradock [mailto:jcradock at me3.com]
Sent: Thursday, March 24, 2005 2:44 PM
To: Lehuta Juraj - OZ
Cc: MAPSERVER-USERS at lists.umn.edu
Subject: Re: [UMN_MAPSERVER-USERS] mapscript installation on debian

This all assumes that Apache2 and PostgreSQL with PostgreSQL's libraries are
installed. Also assumed: That you're running Debian Sarge ("testing").
(Watch the line breaks!)

Change to user root and bring APT up-to-date:

apt-get update

1. Supporting libraries:

Install libraries to make MapServer useful -- many of these are documented
on the UNIX installation page on MapServer's online
documentation:

apt-get install libgd2 libgd2-dev proj libcurl3 libcurl3-dev libtiff4
libtiff4-dev libjpeg62 libjpeg62-dev freetype2 libgdal1 libgdal1-dev

2. PHP:

PHP must be run as a CGI and it must be configured and built with system
regular expressions. This install of PHP will give you PHP as a CGI with
system regex wihout clobbering mod_php (if it's installed) with its built-in
regex -- note that I'm installing the PHP I want to use with MapServer in
/usr/local/php_for_mapserver-4.3.10 and that I'm symlinking it to make
upgrading PHP easier:

cd /usr/local/src
apt-get source php4-cgi
cd php4-4.3.10
./configure --prefix=/usr/local/php_for_mapserver-4.3.10 --enable-dbase
--with-jpeg=/usr --with-tiff=/usr --with-gd=/usr --with-png=/usr
--with-freetype --with-zlib --with-regex=system make make install cp
php.ini-dist /usr/local/php_for_mapserver-4.3.10/lib/php.ini
cd /usr/local
ln -s php_for_mapserver-4.3.10 php_for_mapserver

Setup Apache to execute all *.phtml as PHP CGI. First edit
/etc/apache2/sites-enabled/default (or whatever your default configuration
is):

<Directory "/var/www/mapserver">
    AddType application/x-httpd-php-cgi .phtml
    Action application/x-httpd-php-cgi /cgi-bin/php </Directory>

Then add this shell script, called "php", to the /usr/lib/cgi-bin
directory:

#!/bin/sh

export SCRIPT_FILENAME=$PATH_TRANSLATED
/usr/local/php_for_mapserver/bin/php -c
/usr/local/php_for_mapserver/etc/php.ini

Make it executable:

chmod 755 /usr/lib/cgi-bin/php

Make the "mapserver" directory:

mkdir /var/www/mapserver

And make a phpinfo.phtml file:

echo "<?= phpinfo() ?>" > /var/www/mapserver/phpinfo.phtml

If you restart Apache ("apache2ctl restart") and navigate to
"http://127.0.0.1/mapserver/phpinfo.phtml" you'll see the output you'd
otherwise see loading a page with phpinfo() with the *.php extension.

3. MapServer:

cd /usr/local/src
wget http://cvs.gis.umn.edu/dist/mapserver-4.4.1.tar.gz
tar -zxvf mapserver-4.4.1.tar.gz
cd mapserver-4.4.1
./configure --prefix=/usr/local/mapserver-4.4.1 --with-jpeg
--with-freetype=/usr/local --with-zlib --with-png --with-tiff --with-gd=/usr
--with-proj=/usr --with-gdal=/usr/bin/gdal-config --with-wmsclient
--with-php=/usr/local/php_for_mapserver
--with-postgis=/usr/bin/pg_config --with-mygis=/usr/bin/mysql_config
make
make install

"make install" will print this message to your terminal window:

***** MapServer Installation *****
To install MapServer, copy the 'mapserv' file to your web server's cgi-bin
directory.
If you use MapScript then see the documentation for your specific MapScript
version for installation instructions.

Copy "mapserv" to the CGI-BIB directory:

cp mapserv /usr/lib/cgi-bin/mapserv

Enable PHP/MapScript:

cd mapscript/php3
mkdir /usr/local/php_for_mapserver/lib/php/20020429
cp php_mapscript.so /usr/local/php_for_mapserver/lib/php/20020429/

In /usr/local/php_for_mapserver/lib/php.ini set the extension_dir to
/usr/local/php_for_mapserver/lib/php/20020429/, enable the PHP/MapScript
module:

extension=php_mapscript.so

And copy php_mapscript.so to the extensions directory:

cp php_mapscript.so /usr/local/php_for_mapserver/lib/php/20020429/

Now you don't need to load the module in your PHP script.

Restart Apache and go again to
"http://127.0.0.1/mapserver/phpinfo.phtml". You'll see a block for
MapScript.

4. Gotchas:

* I've enabled MapServer and PHP/MapScript with support for MyGIS. You may
need to install MySQL 4.1's client libraries:

apt-get install libmysqlclient14 libmysqlclient14-dev

* mod_action may need to be enabled in Apache. It's disabled in Debian by
default:

cd /etc/apache2/mods-enabled
ln -s /etc/apache2/mods-available/actions.load .

* Again, this all assumes that Apache2 and PostgreSQL with PostgreSQL's
libraries are installed.

I hope this helps. Let me know if I should make changes to these
instructions.

Thanks.

Jim

On Mar 23, 2005, at 10:23 AM, Lehuta Juraj - OZ wrote:

> Yes, it will be fayn,
> thank you very much
>
> WochteR
>
>
> -----Original Message-----
> From: James Cradock [mailto:jcradock at me3.com]
> Sent: Wednesday, March 23, 2005 4:15 PM
> To: Lehuta Juraj - OZ
> Subject: Re: [UMN_MAPSERVER-USERS] mapscript installation on debian
>
> I would install all the supporting software (apache2, proj, gdal, gd,
> etc -- look at the MapServer UNIX installation docs) from APT and
> build PHP (to run as a CGI alongside mod_php) and MapServer from
> source. I've got an utterly straightforward installation recipe,
> including input for a gotcha or two I've gotten help with from this
> list, for Sarge, and I can send it to you later today and amend it to
> the Debian topic on the MapServer Wiki.
>
> Jim
>
> On Mar 23, 2005, at 10:04 AM, Lehuta Juraj - OZ wrote:
>
>> yes,
>> extension_dir /usr/lib/php4/20020429-zts /usr/lib/php4/20020429-zts
>>
>> and mapscript.so is realy in this directory
>>
>> my Debian is:
>> sarge
>> Linux mapserver 2.6.8-1-686 #1 Thu Nov 25 04:34:30 UTC 2004 i686
>> GNU/Linux
>>
>> I installed mapserver and mapscript packages from deb
>> http://agrogeomatic.educagri.fr/debian woody main
>>
>> by:
>> apt-get install php-mapscript cgi-mapserver php4
>>
>> When I remove the mapscript.so from /usr/lib/php4/20020429-zts I
>> obtain this:
>> Warning: dl(): Unable to load dynamic library
>> '/usr/lib/php4/20020429-zts/php_mapscript.so' -
>> /usr/lib/php4/20020429-zts/php_mapscript.so: cannot open shared
>> object
>> file:
>> No such file or directory in /var/www/test.php on line 2
>>
>> ** cannot open shared object file***
>>
> -----
> James Cradock, jcradock at me3.com
>
> me3 Technology Consultants, LLC
> 24 Preble Street, 2nd Floor
> Portland, ME 04101
>
> 207-772-3217 (office)
> 207-838-8678 (mobile)
>
> www.me3.com
>
>
-----
James Cradock, jcradock at me3.com

me3 Technology Consultants, LLC
24 Preble Street, 2nd Floor
Portland, ME 04101

207-772-3217 (office)
207-838-8678 (mobile)

www.me3.com



More information about the mapserver-users mailing list