我在Ubuntu 16 Server中安装了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,可能会为旧的(或另一个)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
答案 0 :(得分:0)
最后我能够让它发挥作用: