title: Unexpected character/T_STRING error when calling MAXMIND geoip.dat from PHP5 (Windows)
body: <p>I encountered a strange error when trying to call MAXMIND's geoip.dat from their sample PHP script - <a href="http://dev.maxmind.com/geoip/downloadable" rel="nofollow">http://dev.maxmind.com/geoip/downloadable</a></p>
  
  <pre><code>*Warning*: Unexpected character in input: '
  in*C:\Inetpub\wwwroot\clients\geoip\GeoIP.dat*on line*983*
  *Parse error*: syntax error, unexpected T_STRING
  in*C:\Inetpub\wwwroot\clients\geoip\GeoIP.dat*on line*983*
  </code></pre>
  
  <p>Geoip.dat, a binary file, must be downloaded separately from <a href="http://dev.maxmind.com/geoip/geolite" rel="nofollow">http://dev.maxmind.com/geoip/geolite</a>.  Note that there's also a CSV version which I did not use.</p>
  
  <p>My code is almost exactly the same as the sample script, except for the paths:</p>
  
  <pre><code>&lt;?php
  
  // This code demonstrates how to lookup the country by IP Address
  
  include("GeoIP.dat");
  
  // Uncomment if querying against GeoIP/Lite City.
  // include("geoipcity.inc");
  
  $IPaddress=$_SERVER['REMOTE_ADDR'];
  
  $gi =
  geoip_open("C:\Inetpub\wwwroot\clients\geoip\GeoIP.dat",GEOIP_STANDARD);
  
  echo geoip_country_code_by_addr($gi, $IPaddress) . "\t" .
  geoip_country_name_by_addr($gi, $IPaddress) . "\n";
  echo geoip_country_code_by_addr($gi, $IPaddress) . "\t" .
  geoip_country_name_by_addr($gi, $IPaddress) . "\n";
  
  geoip_close($gi);
  
  ?&gt;
  </code></pre>
  
  <p>Here's my PHP info output:</p>
  
  <pre><code>PHP Version 5.2.6
  
  System  Windows NT 5.2 build 3790
  Build Date  May 2 2008 18:01:20
  Configure Command   cscript /nologo configure.js "--enable-snapshot-build" "--with-gd=shared" "--with-extra-includes=C:\Program Files (x86)\Microsoft SDK\Include;C:\PROGRA~2\MICROS~2\VC98\ATL\INCLUDE;C:\PROGRA~2\MICROS~2\VC98\INCLUDE;C:\PROGRA~2\MICROS~2\VC98\MFC\INCLUDE" "--with-extra-libs=C:\Program Files (x86)\Microsoft SDK\Lib;C:\PROGRA~2\MICROS~2\VC98\LIB;C:\PROGRA~2\MICROS~2\VC98\MFC\LIB"
  Server API  ISAPI
  Virtual Directory Support   enabled
  Configuration File (php.ini) Path   C:\WINDOWS
  Loaded Configuration File   C:\Parallels\Plesk\Additional\PleskPHP5\php.ini
  PHP API 20041225
  PHP Extension   20060613
  Zend Extension  220060519
  Debug Build no
  Thread Safety   enabled
  Zend Memory Manager enabled
  IPv6 Support    enabled
  Registered PHP Streams  php, file, data, http, ftp, compress.zlib, https, ftps
  Registered Stream Socket Transports tcp, udp, ssl, sslv3, sslv2, tls
  Registered Stream Filters   convert.iconv.*, string.rot13, string.toupper, string.tolower,
  </code></pre>