A confused Network Admin

Jeff Portwine jdport at VERITIME.COM
Wed Mar 2 05:19:22 PST 2005


Make sure that you have the <?PHP  line in front of everything and that the script is ended with ?>.



I think in the original example he just had <?  which should be ok, but I like to use <?PHP myself.  It looks like your script omitted the  '<', so it wasn't being recognized as a php script and was just reading the script as though it were html and outputting the text to your browser.



Hope this helps,

Jeff





<?PHP

if(!extension_loaded('<extension_name>')) {

        dl('<extension_name>.' . PHP_SHLIB_SUFFIX);

}

$module = '<extension_name>';

$functions = get_extension_funcs($module);

echo "Functions available in the test extension:<br>\n";

foreach($functions as $func) {

    echo $func."<br>\n";

}

echo "<br>\n";

$function = 'confirm_' . $module . '_compiled';

if (extension_loaded($module)) {

        $str = $function($module);

} else {

        $str = "Module $module is not compiled into PHP";

}

echo "$str\n";

?>

  ----- Original Message ----- 
  From: Lisi, Christine 
  To: MAPSERVER-USERS at LISTS.UMN.EDU 
  Sent: Tuesday, March 01, 2005 6:11 PM
  Subject: Re: [UMN_MAPSERVER-USERS] A confused Network Admin


  Thanks, Murilo, but No good.  Now all it's doing is putting the entire script on the page like so:

   

  ? if(!extension_loaded('php_mapscript_44')) { dl('php_mapscript_44.' . PHP_SHLIB_SUFFIX); } $module = 'php_mapscript_44'; $functions = get_extension_funcs($module); echo "Functions available in the test extension:br\n"; foreach($functions as $func) { echo $func."br\n"; } echo "br\n"; $function = 'confirm_' . $module . '_compiled'; if (extension_loaded($module)) { $str = $function($module); } else { $str = "Module $module is not compiled into PHP"; } echo "$str\n"; ?

   

  Can you send me a complete script again with the php_mapscript_44 set?  Does it work for you?

   

  Christine Lisi
  Application Specialist

  Management Information Systems . City of Delray Beach . 100 NW First Avenue, Delray Beach, FL 33444

  Phone, 561-243-7142 . Fax, 561-243-7166 . eMail, Lisi at MyDelrayBeach.com


------------------------------------------------------------------------------

  From: Murilo Lacerda Yoshida [mailto:murilo.yoshida at agx.com.br] 
  Sent: Tuesday, March 01, 2005 6:02 PM
  To: Lisi, Christine; MAPSERVER-USERS at LISTS.UMN.EDU
  Subject: RES: [UMN_MAPSERVER-USERS] A confused Network Admin

   

    Christine,

    Take out the < and the > from the extension name, it should be like this -> php_mapscript_44

   

  -----Mensagem original-----
  De: UMN MapServer Users List [mailto:MAPSERVER-USERS at LISTS.UMN.EDU] Em nome de Lisi, Christine
  Enviada em: terça-feira, 1 de março de 2005 19:58
  Para: MAPSERVER-USERS at LISTS.UMN.EDU
  Assunto: Re: [UMN_MAPSERVER-USERS] A confused Network Admin

   

  Now I have these errors:

   

  Warning: dl() [function.dl]: Unable to load dynamic library 'C:\PHP\<php_mapscript_44>.dll' - The specified module could not be found. in c:\Inetpub\wwwroot\testmapscript.php on line 3
  Functions available in the test extension:

  Warning: Invalid argument supplied for foreach() in c:\Inetpub\wwwroot\testmapscript.php on line 8

  Module is not compiled into PHP

   

  Christine Lisi
  Application Specialist

  Management Information Systems . City of Delray Beach . 100 NW First Avenue, Delray Beach, FL 33444

  Phone, 561-243-7142 . Fax, 561-243-7166 . eMail, Lisi at MyDelrayBeach.com


------------------------------------------------------------------------------

  From: Murilo Lacerda Yoshida [mailto:murilo.yoshida at agx.com.br] 
  Sent: Tuesday, March 01, 2005 5:39 PM
  To: Lisi, Christine; MAPSERVER-USERS at LISTS.UMN.EDU
  Subject: RES: [UMN_MAPSERVER-USERS] A confused Network Admin

   

    Christine,

    The line 12 is this -> ($function = 'confirm_' . $module ... '_compiled';)?

    If it is then ther is 3 points together . make it one point only . I don't know why it went with 3 points . in my script and in my copy of the email I sent you it is with one point . strange . but just remove the points and it should work

   

  -----Mensagem original-----
  De: UMN MapServer Users List [mailto:MAPSERVER-USERS at LISTS.UMN.EDU] Em nome de Lisi, Christine
  Enviada em: terça-feira, 1 de março de 2005 18:24
  Para: MAPSERVER-USERS at LISTS.UMN.EDU
  Assunto: Re: [UMN_MAPSERVER-USERS] A confused Network Admin

   

  Murilo,

   

  I copied and pasted your script into notepad and created the .php file from it (which is what I assume you wanted me to do).  I ran the script through the browser and received the following error:

   

  Parse error: syntax error, unexpected '.' in c:\Inetpub\wwwroot\testmapscript.php on line 12 

   

  Christine Lisi
  Application Specialist

  Management Information Systems . City of Delray Beach . 100 NW First Avenue, Delray Beach, FL 33444

  Phone, 561-243-7142 . Fax, 561-243-7166 . eMail, Lisi at MyDelrayBeach.com


------------------------------------------------------------------------------

  From: Murilo Lacerda Yoshida [mailto:murilo.yoshida at agx.com.br] 
  Sent: Tuesday, March 01, 2005 4:02 PM
  To: Lisi, Christine; MAPSERVER-USERS at LISTS.UMN.EDU
  Subject: RES: [UMN_MAPSERVER-USERS] A confused Network Admin

   

    Christine,

    This is a generic test that php provides when you create a extension... It should work for all extensions, but sometimes it doesn't, because if the extension doesn't have the 'confirm_' . $module . '_compiled' function implemented it will throw you an error message.

    But if it don't throw you a message on the line 3 (dl('<extension_name>.' . PHP_SHLIB_SUFFIX);), you can assume the extension is working.

    Change <extension_name> for the name of the extension, like php_mapscript_44, without ....dll.

   

  <?

  if(!extension_loaded('<extension_name>')) {

          dl('<extension_name>.' . PHP_SHLIB_SUFFIX);

  }

  $module = '<extension_name>';

  $functions = get_extension_funcs($module);

  echo "Functions available in the test extension:<br>\n";

  foreach($functions as $func) {

      echo $func."<br>\n";

  }

  echo "<br>\n";

  $function = 'confirm_' . $module ..... '_compiled';

  if (extension_loaded($module)) {

          $str = $function($module);

  } else {

          $str = "Module $module is not compiled into PHP";

  }

  echo "$str\n";

  ?>

   

  -----Mensagem original-----
  De: UMN MapServer Users List [mailto:MAPSERVER-USERS at LISTS.UMN.EDU] Em nome de Lisi, Christine
  Enviada em: terça-feira, 1 de março de 2005 17:48
  Para: MAPSERVER-USERS at LISTS.UMN.EDU
  Assunto: Re: [UMN_MAPSERVER-USERS] A confused Network Admin

   

  Murilo,

   

  Thanks so much for the info.  I am running PHP5 so I put the .dll in the root folder, which is where the php.ini is looking for it.  I also added a Windows Extension in the Windows Extensions section of the ini.  How do I test this?  I know there's a command like switch I can run to see if all of the extensions are working but I can't remember it.

   

  Christine Lisi
  Application Specialist

  Management Information Systems . City of Delray Beach . 100 NW First Avenue, Delray Beach, FL 33444

  Phone, 561-243-7142 . Fax, 561-243-7166 . eMail, Lisi at MyDelrayBeach.com


------------------------------------------------------------------------------

  From: Murilo Lacerda Yoshida [mailto:murilo.yoshida at agx.com.br] 
  Sent: Tuesday, March 01, 2005 3:29 PM
  To: Lisi, Christine; MAPSERVER-USERS at LISTS.UMN.EDU
  Subject: RES: [UMN_MAPSERVER-USERS] A confused Network Admin

   

    Christine,

    The php_mapscript_44.dll file should be put on the extension_dir path, that is set on the php.ini file.

   

  -----Mensagem original-----
  De: UMN MapServer Users List [mailto:MAPSERVER-USERS at LISTS.UMN.EDU] Em nome de Lisi, Christine
  Enviada em: terça-feira, 1 de março de 2005 17:19
  Para: MAPSERVER-USERS at LISTS.UMN.EDU
  Assunto: Re: [UMN_MAPSERVER-USERS] A confused Network Admin

   

  Ed,

   

  Thanks for your support on this.  You seem to be the only one who responds to any of my inquiries so I am grateful!  In response.

   

  Questions:

  2.       I read somewhere that PHP will not work with MapServer unless it is set up as a CGI.  Is this true?

  3.       Supposedly they were working on the SAPI version.  Is this available yet?

  Answer:

     You should use PHP as a CGI.  This is simpler and avoids problems with multithreading.

  Response:

  Per your suggestion, I have changed the install to CGI.  I guess all that work setting up PHP as an ISAPI was a good learning experience!  It is still working set up as a CGI.

   

  Question:

  4.       Where do I put the php_mapscript_44.dll file?

  Answer:

      You should think about the MapServer CGI and the MapScript DLL as two different applications built upon the same MapServer libraries.  There's a core of map-rendering functionality that can be wrapped with a CGI interface (mapserv.exe) or with a PHP scripting interface (php_mapscript_44.dll).  While they share a lot of code, of course, these two are completely separate applications, and they are quite independent of each other.  php_mapscript_44.dll is a PHP "module" and is loaded by the PHP interpreter when it is referenced by a PHP script being executed.  The MapServer CGI does not use the php_mapscript_44.dll file at all.

  Response:

  Thanks for the input, Ed, but I don't think I'll understand this whole setup until the consultant comes in and actually makes it all work!  I hope someone else will respond to my questions.  I still don't know where to put the files and how to test them.

   

  You're doing very well for having a lot of new stuff thrown at you.  Thanks.  The pat on the back feels good after all this stress!  Do not worry about ISAPI implementations or the "performance penalty" of CGI (a limitation that, IMHO, has been greatly oversold by Microsoft).  If - after you've got everything working well - you think there are performance gains to be had by improving on the CGI interface, we can talk about that then.  But let's make work correctly first, THEN make it work faster <g>.

  Microsoft talks about the fact that with CGI's the executable is memory resident as many times as it is being run.  So, for example, if 5 users are running the CGI then it is taking up 5x the memory.  That's the way I understand it from Microsoft's standpoint but I could be wrong.  I've read so much in the last two weeks that my brain is a bit mushy.

   

  Christine Lisi
  Application Specialist

  Management Information Systems . City of Delray Beach . 100 NW First Avenue, Delray Beach, FL 33444

  Phone, 561-243-7142 . Fax, 561-243-7166 . eMail, Lisi at MyDelrayBeach.com


------------------------------------------------------------------------------

  From: UMN MapServer Users List [mailto:MAPSERVER-USERS at LISTS.UMN.EDU] On Behalf Of Ed McNierney
  Sent: Tuesday, March 01, 2005 12:47 PM
  To: MAPSERVER-USERS at LISTS.UMN.EDU
  Subject: Re: [UMN_MAPSERVER-USERS] A confused Network Admin

   

  Christine -

   

  It sounds like you're off to a good start!  I'll try to contribute, and there are others with different expertise who can chime in as well.  Be sure to send replies to the entire list, not just to the sender, since you've got a number of questions that are best answered by a few different people.

   

  Question:

  1.       I set this up as a CGI in IIS6.  Is there an SAPI version for IIS?

  Answer:

     No, there is no ISAPI version for IIS.  Using MapServer as a CGI will work fine.  Since you got the appropriate error message, you've got the permissions (for executing CGI, etc.) set up properly.

   

  Questions:

  2.       I read somewhere that PHP will not work with MapServer unless it is set up as a CGI.  Is this true?

  3.       Supposedly they were working on the SAPI version.  Is this available yet?

  Answer:

     You should use PHP as a CGI.  This is simpler and avoids problems with multithreading.

   

  Questions:

  4.       Where do I put the php_mapscript_44.dll file?

  Answer:

      You should think about the MapServer CGI and the MapScript DLL as two different applications built upon the same MapServer libraries.  There's a core of map-rendering functionality that can be wrapped with a CGI interface (mapserv.exe) or with a PHP scripting interface (php_mapscript_44.dll).  While they share a lot of code, of course, these two are completely separate applications, and they are quite independent of each other.  php_mapscript_44.dll is a PHP "module" and is loaded by the PHP interpreter when it is referenced by a PHP script being executed.  The MapServer CGI does not use the php_mapscript_44.dll file at all.

   

  You're doing very well for having a lot of new stuff thrown at you.  Do not worry about ISAPI implementations or the "performance penalty" of CGI (a limitation that, IMHO, has been greatly oversold by Microsoft).  If - after you've got everything working well - you think there are performance gains to be had by improving on the CGI interface, we can talk about that then.  But let's make work correctly first, THEN make it work faster <g>.

   

      - Ed

  Ed McNierney
  President and Chief Mapmaker
  TopoZone.com / Maps a la carte, Inc.
  73 Princeton Street, Suite 305
  North Chelmsford, MA  01863
  ed at topozone.com
  (978) 251-4242 

   


------------------------------------------------------------------------------

  From: UMN MapServer Users List [mailto:MAPSERVER-USERS at LISTS.UMN.EDU] On Behalf Of Lisi, Christine
  Sent: Tuesday, March 01, 2005 12:01 PM
  To: MAPSERVER-USERS at LISTS.UMN.EDU
  Subject: [UMN_MAPSERVER-USERS] A confused Network Admin

  Prior to last week, I had no experience with PHP, MapServer, MapScript, MapSurfer, etc. and have been thrown into this very confusing and frustrating Open Source world.  I have successfully installed ArcSDE, MapServer and PHP, but I have no idea how each piece talks to the other and whether or not they will work once our consultant visits.  I am only responsible for the setup of the apps, and the rest will be up to our engineers and the consultant.  I have several questions and I hope some of you can answer them in a language I can understand.  Please remember that I honestly don't understand how these applications work at all.  I am a Network Admin and Application Specialist, but have no experience with GIS/Mapping, etc.

   

  Our Server:

  Windows Server 2003

  IIS6

  ArcSDE 9.0 w/ SP2

  SQL Server 2000 w/ SP3a

   

  General Notes:

  For all of the installs below I used environment variables and set the System Path to point to the individual application directories.  I did NOT copy any .....dll's to my System32 directory.  This is definitely a preferred method for me.

   

  MAPSERVER (v. 4.4.1):

  I followed the instructions in the README-install.txt and successfully received the "No query information to decode.  QUERY_STRING is set, but empty." message.

  Question:

  1.       I set this up as a CGI in IIS6.  Is there an SAPI version for IIS?

   

  PHP (v5.0.3):

  I followed the instructions in the install.txt and set this up as a server module (SAPI).  I did run the .exe file, but I then configured it manually as a server module per the instructions.  There was nothing in the documentation about how to test this program so after about an hour of research on the PHP web site I read how to create a Hello.php file and put it in the wwwroot folder and had successful results.  I assume the software is working.

  Questions:

  2.       I read somewhere that PHP will not work with MapServer unless it is set up as a CGI.  Is this true?

  3.       Supposedly they were working on the SAPI version.  Is this available yet?

   

  PHP/MAPSCRIPT MAPSERVER MODULE:

  I downloaded this module and read the README.txt.  I'm very confused as to whether this is a module for MapServer or PHP.  The download for this module included several .dll's that are already in my MapServer directory.

  Questions:

  4.       Where do I put the php_mapscript_44.dll file?

  5.       How do I test it?

   

  MAPSURFER (v1.5):

  I downloaded and extracted the files.  Per the README.txt file, I edited the mapper.html file and set the location of the MapServer cgi program and the .map definition file (var mapserver = '/cgi-bin/mapserv.exe'; var mapfile = 'test.map';")

  Questions:

  6.       Where do I put the extracted MapSurfer folder?  I put it in the wwwroot folder.  The Readme.txt file says to "Put the MapSurfer directory somewhere accessible to the web."   This is not clear to me.

  7.       How do I test this?

   

  Thank you to all of you who read these messages.  I have to give you credit because I am very confused!  I welcome any comments, even those that do not apply to my questions.

  Christine Lisi
  Application Specialist

  Management Information Systems . City of Delray Beach . 100 NW First Avenue, Delray Beach, FL 33444

  Phone, 561-243-7142 . Fax, 561-243-7166 . eMail, Lisi at MyDelrayBeach.com

   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20050302/21070597/attachment.htm>


More information about the MapServer-users mailing list