Install Lapack in PHP

I am trying to install Lapack to use it with PHP ( http://php.net/manual/en/book.lapack.php ), as this is the only PHP library I have found that contains calculations for singular values.

I am on a Ubuntu 14.04 server with Apache2.

I installed gfortran and liblapack-dev, as indicated on other sites, but they all stop describing how to enable it. In short, I get qerror when calling a static function from Lapack, saying that it is not a specific class.

I believe that my next step includes the extension, but despite this question ( How to check which PHP extensions were enabled / disabled in Ubuntu Linux 12.04 LTS? ) I did not find any mention of Lakpek. How do I resume installing Lapack for PHP? Thank you

+8
php ubuntu lapack
source share
1 answer

Install Lapack from source

Note. Tested on Ubuntu 16.04.

Set prerequisites:

sudo apt-get install php5-dev git svn cmake gfortran liblapack-dev 

Follow the instructions here (copied for convenience):

 svn co https://icl.cs.utk.edu/svn/lapack-dev/lapack/trunk lapack cd lapack mkdir build cd build cmake -D BUILD_SHARED_LIBS=ON -D LAPACKE=ON ../ make sudo make install 

This will create a shared Lapack library. Now clone the php extension from the source:

 git clone https://github.com/ianbarber/php-lapack 

And follow the instructions described there :

 cd php-lapack phpize ./configure make sudo make install 

Check if the extension is installed: php -m | grep -i lapack php -m | grep -i lapack

Please note that the extension is most likely incompatible with PHP 7, as it has not been updated for more than 5 years.

+3
source share

All Articles