代码之家  ›  专栏  ›  技术社区  ›  Arivan Bastos

Ubuntu 16上的fann\u create\u from\u file()未定义函数

  •  -1
  • Arivan Bastos  · 技术社区  · 7 年前

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

    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) ...
    

    似乎没有错误,但当我尝试从\u file()调用fann\u create\u时,我得到:

    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安装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
    

    构建过程运行成功,所以我在PHP中添加了“fann.so”。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 回复  |  直到 7 年前
        1
  •  0
  •   Arivan Bastos    7 年前

    最后,我成功了:

    1. sudo apt get安装libfann dev
    2. sudo apt get安装php5.6-dev
    3. sudo apt get安装php pear
    4. sudo-pecl安装fann(这将生成“fann.so”的正确版本,并将其放在一个php可用的文件夹中)
    5. 将以下行添加到PHP。ini“扩展=扇形so;”