Skip to content
geonef edited this page Mar 19, 2012 · 3 revisions

Compilation

Dependencies

The following packages are needed (name of Debian packages) :

  • libgdal (>= 1.7) (above. Make sure you have both the binaries and dev packages)
  • php5-dev
  • unixodbc-dev
  • libjasper-dev
  • libhdf5-serial-dev
  • libhdf4-alt-dev

The GDAL library needs to have OGR built in, as php5-gdal does not isolate OGR from GDAL builds, so it depends on both. Which means, GDAL must not be configured with --without-ogr at compilation. The default is fine.

Prepare the source

Fetch the source into a new directory and chdir to it.

Replace the following /usr with the correct path if needed. For example, if you had to compile libgdal yourself, you may have to specify /usr/local instead.

$ phpize
$ ./configure --enable-gdal=/usr

Compile

$ make

Install

  • Copy the file modules/gdal.so to /usr/lib/php5/20090626/.
  • Create the file /etc/php5/conf.d/gdal.ini with this content: (Works on a Debian distribution. These lines just need to be added to php.ini in one way or another. Change /usr/share/gdal to the actual place of GDAL data installation if different, such as /usr/local/share/gdal)
; configuration for GDAL module
extension=gdal.so
[gdal]
gdal.gdal_data=/usr/share/gdal
  • Restart your HTTP server if you are using one (for Apache: "apachectl graceful")

Check

Watch the result of phpinfo(), a new block should appear about GDAL, as shown in the following example:

PHP info

Clone this wiki locally