Setup LibXL in PHP (Linux)

Thanks to Ilia Alshanetsky for this extension for PHP. Please follow the instructions below:


1. Install Apache and PHP if they don't exist:

sudo apt-get update
sudo apt-get install apache2
sudo apt-get install php7
2. Install files to develop PHP modules:

sudo apt-get install php7-dev
3. Download and unpack the latest LibXL package:

wget http://libxl.com/download/libxl-lin-latest.tar.gz
tar xvfz libxl-lin-latest.tar.gz
4. Get php_excel module source code:

git clone -b php7 https://github.com/iliaal/php_excel.git
5. Prepare the build environment for the PHP extension and configure it:

cd php_excel_master
phpize
./configure --with-libxl-incdir=../libxl-3.8.6.0/include_c --with-libxl-libdir=../libxl-3.8.6.0/lib64
or
./configure --with-libxl-incdir=../libxl-3.8.6.0/include_c --with-libxl-libdir=../libxl-3.8.6.0/lib for a 32-bit operating system
6. Make and install php_excel extension:

make
sudo make install

If you get the following error:
/usr/include/php5/ext/xml/expat_compat.h:36:27: fatal error: libxml/parser.h: No such file or directory
#include
then try to add "-with-libxml-dir=/usr/include/libxml2" parameter to "configure" script.
7. Add the extension to PHP configuration file:

sudo vi /etc/php5/apache2/conf.d/excel.ini

Add the following line to excel.ini and save it:
extension=excel.so
8. Restart Apache web server:

sudo service apache2 restart
9. Web server is ready for using LibXL functions.