[mapserver-users] Re: Installing PHP MapScript with MapServer 6.0.0-3 and PHP 5.3.6 on Mac OS X 10.6.8

Ben Madin lists at remoteinformation.com.au
Wed Jul 6 09:33:30 EDT 2011


Léo,

First, I'd volunteer that you have incorrect paths - using ~ probably isn't going to work unless the webserver is running as you (unlikely, but possible)

I'm assuming from what you have that your system looks like (and your user is called macbook) :

Sites
  |
  +---mapserver
          |
          +----- introduction
          |         |
          |         +----- test.map
          |         |
          |         +----- shape
          |                  |
          |                  +----- europe.shp etc
          |
          +----- temp
          |
          +----- test.php


> $map = ms_newMapObj("~/macbook/Sites/mapeserver/introduction/test.map");

probably then should be :

$map = ms_newMapObj("introduction/test.map");

> SHAPEPATH "~/macbook/Sites/mapserver/introduction/shape/"

probably then should be :

SHAPEPATH "/Users/macbook/Sites/mapserver/introduction/shape/"

>  IMAGEPATH '~/macbook/Sites/mapeserver/temp/'

probably then could be :

 IMAGEPATH 'temp/'

>  IMAGEURL  '/temp/'

should then work.

You also need to make the temp/ directory writeable by the webserver - for now, I'd just Get Info on the directory, and make that directory write and read by anyone - security risk blah, but for now, just get it working.

Then open your Console (in Utilities) and navigate down to FILES > /private/var/log > apache2 > error_log

if you have error logging turned on in php.ini, this will help you enough to find out what is going wrong.

If you are really stuck I'd go with Daniel's suggestion on turning on debugging in mapserver, which you will need to do while you are learning, but for now just the apache error log should get you started.

Good luck.

cheers

Ben


On 06/07/2011, at 10:01 PM, mapserver-users-request at lists.osgeo.org wrote:

> From: Léo D. <leo_dumont at yahoo.fr>
> Date: 6 July 2011 12:19:19 AM AWST
> To: mapserver-users at lists.osgeo.org
> Subject: [mapserver-users] Re: Installing PHP MapScript with MapServer 6.0.0-3 and PHP 5.3.6 on Mac OS X 10.6.8
> 
> 
> Thanks to both of you for your answers.
> 
> I've allready edit my php.ini to add "extension=php_mapscript.so" and with a
> phpinfo() I can see the section about MapScript.
> Moreover when I run this script to test if the extension is loaded or not
> and I have a positive result, so I think that PHP MapScript is working:
> 
> if (!extension_loaded('MapScript')) {
> echo"Not loaded";
> }
> else {
> echo"Loaded!";
> }
> 
> But when I try to run the example script from the mapserver.org
> documentation (without the dl() instruction), it doesn't work and I have no
> error message, just an empty page. Here is my php code:
> 
> <?php
> $map = ms_newMapObj("~/macbook/Sites/mapeserver/introduction/test.map");
> $image = $map->draw();
> $image_url = $image->saveWebImage();
> 
> echo'<html>
>   <head>
>     <title>Exemple : Afficher un shapefile</title>
>   </head>
>   <body>
>      '.$image_url.' 
>   </body>
> </html>';
> ?>
> 
> And here is my mapfile:
> 
> MAP
> NAME "Europe en bleu"
> SIZE 400 400
> STATUS ON
> EXTENT -31.2467 27.6065 40.1199 80.762
> UNITS DD
> SHAPEPATH "~/macbook/Sites/mapserver/introduction/shape/"
> 	
> WEB
>  IMAGEPATH '~/macbook/Sites/mapeserver/temp/'
>  IMAGEURL  '/temp/'
> END
> 
> LAYER
>  NAME "Europe"
>  TYPE POLYGON
>  STATUS ON
>  DATA "europe"
>  CLASS
>    STYLE
>      COLOR 20 10 110
>      OUTLINECOLOR 200 200 200
>    END
>  END
> END
> 
> END
> 
> Maybe I've made a mistake in one of these files…
> Thanks for your help !
> 
> Léo
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20110706/8533e2eb/attachment-0001.html


More information about the mapserver-users mailing list