• Increase font size
  • Default font size
  • Decrease font size
Home Software Automap Automap Install Guide

Automap Install Guide

E-mail Print
Read : 6,033 times
(0 votes, average 0 out of 5)

1 - Pre-requisites

Automap requires PHP 5.3.0 or more.

2 - Getting Automap

Download the latest tgz package from Github and uncompress/untar it. Always choose the release tagged as 'Latest release'.

In the newly-created directory, you will find some examples, documentation, tests, but the most important file is automap.phk. It is located in the base directory and contains the code to build and manage map files, and the runtime code. This file is a PHK package. It is used as a PHP script and it has two possible behaviors : when run in command-line mode, it acts as a tool to build and manage map files. When included from another PHP script, it loads the Automap runtime code. This file has no dependency. You may locate it anywhere.

As the automap.phk file is also the Automap runtime library, you will include it in your code tree and distribute it with your application. It must be require()d at the beginning of every request, before loading the map(s). It can be located anywhere.

Read the tutorial to learn how to build your first map.

3 - The PECL extension

3.1 - Introduction

You may OPTIONALLY install a PECL extension to improve performance. I put a strong emphasis on 'OPTIONALLY' because people sometimes wrongly state that Automap cannot be used in environments where you cannot install a C extension. Let's say it once again : the PECL extension is just an accelerator. It does not modify any feature. Without the extension, Automap is already very fast, the extension just makes it still faster.

What this means is that you don't need the PECL extension to discover, learn, and even use Automap, even in production, as it is probably the fastest PHP autoloader available today ! Once you are familiar with the software and want to increase your application performance, you may think about installing the extension.

The automap accelerator code is contained in the PHK PECL extension, which also contains the accelerator code for PHK packages. Both accelerators are merged in the same PECL extensions for different reasons, the main being that it allows for several performance optimizations. But, even when using Automap out of PHK packages, installing the PHK PECL extension will dramatically improve your runtime performance.

The extension is totally transparent to the user. When it is present, it is used automatically. There's no configuration, no php.ini flags. Just install, enable it in php.ini, and enjoy !

3.2 - Installing a precompiled package

First, look for a precompiled package in your OS distribution or on the internet. There are pros and cons, of course, as the precompiled packages you will find may not be the latest version but, if you want to avoid compilation and installation, this is probably the best solution.

Precompiled packages for Windows are available on the windows.php.net server

3.3 - Compiling and Installing the extension

If you don't find a precompiled package suited to your environment, or if, like me, you prefer compiling it by yourself, the extension is compiled and installed as any other PECL extension.

:note Note: The instructions below apply to Unix-like environments only, as I am totally unable to compile a PECL extension on a non-Unix environment. More information on PECL extension installation is available from this chapter of the PHP documentation


  • You need the make utility and a C compiler. I personnally use gcc but any Ansi-compliant C compiler should work (if this is not the case, please report a bug).
  • You also need the PHP header files, generally available from a 'php-devel' package.

3.3.1 - Using the 'pecl' command

If the host you're running on is connected to the Internet, the easiest solution is to use the 'pecl' command. Just run :

pecl install phk

This should download the software, compile it, and install it. Then, you just need to enable the extension in the 'php.ini' file (adding an 'extension=phk.so' line.

3.3.2 - Using phpize

If using the 'pecl' command is not an option, you may use the lower-level method :

Download the latest source package from the PECL repository, uncompress/extract it and cd to the extracted directory.

Ensure the phpize command is in your path and run :

phpize && ./configure && make install

This should install the automap module in the PHP extensions directory.

Then, activate it by adding to you php.ini file a line saying :


:note Note: Depending on your environment (HP-UX, AIX, Windows...), the file suffix ('.so') may change. If the line above doesn't work, check the name of the just-compiled extension file and use it on the 'extension=' line.

If you don't know where your php.ini file is located, run :

php -i | fgrep '.ini'

and check the lines starting with 'Loaded Configuration File' and 'Scan this dir for additional .ini files'. You will also find a lot of help on the web

That's all! You may now check that the extension is active by running the 'php -m' command. The output shouldn't display any error message and should contain one line saying 'phk'.

The extension has no configuration parameter nor ini setting. Once active, it is automatically used by the Automap and PHK software.


Please login or register to add a comment