我在 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 为较旧的(或其他)php 安装配置 lib fann 吗?
更新 1
我也试过sudo apt-get install libfann-dev
更新 2
Ubuntu 14上的相同问题
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