php lapack library

Discussion in 'General' started by Arianna, Nov 7, 2018.

  1. Arianna

    Arianna Member

    Dear support,

    a user on my ispconfig platform needs to use lapack libraries.
    I add them to the server following the instruction in http://php.net/manual/it/book.lapack.php but the php page responds: Fatal error: Class 'Lapack' not found in.....

    I installed the same libraries on my pc and everithing went well: what kind of configuration do I have to do?

    Thanks,
    A.
     
  2. Jesse Norell

    Jesse Norell Well-Known Member Staff Member Howtoforge Staff

    I don't know from that link where the library will be installed, but find where the files went (eg. under /usr/local/.... ?) and make sure that directory is in php open_basedir (under the website's Options tab). You may/will also need to set php's include path include that.
     
  3. Arianna

    Arianna Member

    Hi,
    This is what I find with "locate lapack"
    /usr/lib64/R/lib/libRlapack.so
    /usr/lib64/R/modules/lapack.so
    /usr/local/include/lapacke.h
    /usr/local/include/lapacke_config.h
    /usr/local/include/lapacke_mangling.h
    /usr/local/include/lapacke_utils.h
    /usr/local/lib/cmake/lapacke-3.6.1
    /usr/local/lib/cmake/lapacke-3.6.1/lapacke-targets-noconfig.cmake
    /usr/local/lib/cmake/lapacke-3.6.1/lapacke-targets.cmake
    /usr/local/lib64/liblapack.so
    /usr/local/lib64/liblapack.so.3
    /usr/local/lib64/liblapack.so.3.6.1
    /usr/local/lib64/liblapacke.so
    /usr/local/lib64/cmake/lapack-3.6.1
    /usr/local/lib64/cmake/lapacke-3.6.1
    /usr/local/lib64/cmake/lapack-3.6.1/lapack-config-version.cmake
    /usr/local/lib64/cmake/lapack-3.6.1/lapack-config.cmake
    /usr/local/lib64/cmake/lapack-3.6.1/lapack-targets-noconfig.cmake
    /usr/local/lib64/cmake/lapack-3.6.1/lapack-targets.cmake
    /usr/local/lib64/cmake/lapacke-3.6.1/lapacke-config-version.cmake
    /usr/local/lib64/cmake/lapacke-3.6.1/lapacke-config.cmake
    /usr/local/lib64/pkgconfig/lapack.pc
    /usr/local/lib64/pkgconfig/lapacke.pc

    The php_openbasedir id:
    /var/www/clients/client13/web18/web:/var/www/clients/client13/web18/private:/var/www/clients/client13/web18/tmp:/var/www/aaa.unimi.it/web:/srv/www/aaa.unimi.it/web:/usr/share/php5:/usr/share/php:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin:/usr/local/lib64:/usr/local/lib:/usr/local/include

    and this is the php script I use to test:
    <?php

    set_include_path('/usr/local/lib64');
    #include('/usr/local/lib64/liblapack.so');

    $a = array(
    array( 6.80, -6.05, -0.45, 8.32, -9.67 ),
    array(-2.11, -3.30, 2.58, 2.71, -5.14 ),
    array( 5.66, 5.36, -2.70, 4.35, -7.26 ),
    array( 5.97, -4.44, 0.27, -7.17, 6.08 ),
    array( 8.23, 1.08, 9.04, 2.14, -6.87 ),
    );

    $b = array(
    array( 4.02, -1.56, 9.81 ),
    array( 6.19, 4.00, -4.09 ),
    array( -8.22, -8.67, -4.57 ),
    array( -7.57, 1.75, -8.61 ),
    array( -3.03, 2.86, 8.99 ),
    );

    $result = Lapack::solveLinearEquation($a, $b);

    ?>
    But still : Fatal error: Class 'Lapack' not found in /var/www/clients/client13/web18/web/uno.php on line 23
     
  4. Jesse Norell

    Jesse Norell Well-Known Member Staff Member Howtoforge Staff

    Ah, a .so is binary code which needs loaded via the ini, not included php code. Try adding extension=/usr/local/lib64/liblapack.so to your php.ini then restart php (eg. php-fpm or whatever mode you use) and ignore/remove the set_include_path()/include() stuff.
     
  5. Arianna

    Arianna Member

    sorry,
    nothing changed and in phpinfo() it doesn't show up.
    mod_fcgid: stderr: PHP Fatal error: Class 'Lapack' not found in /var/www/clients/client13/web18/web/uno.php on line 21
     
  6. Jesse Norell

    Jesse Norell Well-Known Member Staff Member Howtoforge Staff

    You sure you added that to the correct php.ini? You should find the location in phpinfo() output to verify. Other than that I don't really know, I've not used that myself.
     

Share This Page