fann_create_from_file() Ubuntu 16 上的未定义函数

fann_create_from_file() undefined function on Ubuntu 16

我在 Ubuntu 16 服务器上安装了 php fann (https://github.com/bukka/php-fann),控制台输出如下:

sudo apt-get install libfann-*
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'libfann-dbg' for glob 'libfann-*'
Note, selecting 'libfann-dev' for glob 'libfann-*'
Note, selecting 'libfann-doc' for glob 'libfann-*'
The following NEW packages will be installed:
  libfann-dbg libfann-dev libfann-doc
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/1,860 kB of archives.
After this operation, 14.2 MB of additional disk space will be used.
Selecting previously unselected package libfann-dev:amd64.
(Reading database ... 86590 files and directories currently installed.)
Preparing to unpack .../libfann-dev_2.2.0+ds-2_amd64.deb ...
Unpacking libfann-dev:amd64 (2.2.0+ds-2) ...
Selecting previously unselected package libfann-doc.
Preparing to unpack .../libfann-doc_2.2.0+ds-2_all.deb ...
Unpacking libfann-doc (2.2.0+ds-2) ...
Selecting previously unselected package libfann-dbg:amd64.
Preparing to unpack .../libfann-dbg_2.2.0+ds-2_amd64.deb ...
Unpacking libfann-dbg:amd64 (2.2.0+ds-2) ...
Setting up libfann-dev:amd64 (2.2.0+ds-2) ...
Setting up libfann-doc (2.2.0+ds-2) ...
Setting up libfann-dbg:amd64 (2.2.0+ds-2) ...

似乎没有错误,但是当我尝试调用 fann_create_from_file() 时,我得到:

Call to undefined function fann_create_from_file() in /var/www/html/../somefile.php on line XX

有什么问题吗?我正在使用 PHP 5.6,可能 apt-get 配置 lib fann 用于较旧的(或其他)php 安装?

更新 1

我也试过了sudo apt-get install libfann-dev

更新 2

Ubuntu14

上的相同问题
sudo apt-get install libfann-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
  libfann-doc
The following NEW packages will be installed:
  libfann-dev
0 upgraded, 1 newly installed, 0 to remove and 199 not upgraded.
Need to get 0 B/176 kB of archives.
After this operation, 703 kB of additional disk space will be used.
Selecting previously unselected package libfann-dev.
(Reading database ... 56278 files and directories currently installed.)
Preparing to unpack .../libfann-dev_2.1.0~beta~dfsg-8ubuntu1_amd64.deb ...
Unpacking libfann-dev (2.1.0~beta~dfsg-8ubuntu1) ...
Setting up libfann-dev (2.1.0~beta~dfsg-8ubuntu1) ...

运行:

Call to undefined function fann_create_from_file

更新 3

我编译了 "fann.so" 库 运行:

git clone --recursive https://github.com/bukka/php-fann.git
cd php-fann
phpize
./configure --with-fann
make
sudo make install

构建过程成功运行,所以我将 "fann.so" 添加到我的 PHP.ini 并且我得到:

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/20131226/fann.so' - /usr/lib/php/20131226/fann.so: undefined symbol: zend_list_close in Unknown on line 0

我终于成功了:

  1. sudo apt-get 安装 libfann-dev
  2. sudo apt-get 安装 php5.6-dev
  3. sudo apt-get 安装 php-pear
  4. sudo pecl install fann(这将构建 "fann.so" 的正确版本并将其放入 php 可访问文件夹中)
  5. 将以下行添加到 PHP.ini "extension=fann.so;"