NixUser | Unix User | Linux User | NixUser

Install fann PHP extension

To install fann extension in php, make sure that libfann (development version) is installed on your system. If it is not installed, you can install it using yum or apt-get depending on your distro.

$ yum install fann-devel

Or in Ubnuntu:

$ sudo apt-get install libfann-dev

This extension is available on PECL. The installation is very simple. Run the following command:

$ sudo pecl install fann

If you want to install it manually, download the source code zip file from Github. Go to Github and click the “Download ZIP” button to download it. Or download it fann official download page.

Then run the following commands:

$ unzip
$ cd php-fann-master
$ phpize
$ ./configure
$ make all
$ sudo make install

Now you have to update the php.ini file to load the extension in php.

Make sure the extension_dir variable is pointing to the correct directory containing file. The build will display where it is installing the PHP driver with output similar to:

Installing ‘/usr/lib/php/extensions/no-debug-non-zts-xxxxxxxx/’

Verify that the extension directory is same by using the following:

$ php -i | grep extension_dir
extension_dir => /usr/lib/php/extensions/no-debug-non-zts-xxxxxxxx =>

If it’s not, change the extension_dir in php.ini or move file to the extension_dir.

To load the extension on PHP startup, add the following line in php.ini:

Restart apache web service and you should be ready to go.