Using PHP with PEAR to export an Excel File
Some people like to tell us “Use COM object to create an Excel File”.
It is a general answer, if you are using Windows OSs and installed Microsoft Office with Excel Application.
So, how do we can create an Excel File without using any Microsoft / Windows components ?
PEAR is one of best way for us to complete this mission.
PEAR Official Website
PEAR @ Wiki
sudo apt-get install php-pear
To install PEAR and its relative package.
sudo gedit /etc/php5/apache2/php.ini
find include_path after UNIX
uncomment include_path and edit the string of included path to .:/usr/share/php:/usr/share/php/PEAR
(Note: The included path base on which path you would like to include, you can add more included path separated by a colon)
sudo service apache2 restart
To restart Apache2
Visit http://pear.php.net/package/Spreadsheet_Excel_Writer/download and http://pear.php.net/package/OLE/download
to download Spreadsheet_Excel_Writer and OLE package.
You can download and move them to specific locations manually.
Copy the PEAR Install Command and paste them to Terminal to install them automatically.
sudo pear install Spreadsheet_Excel_Writer-0.9.2
sudo pear install OLE-1.0.0RC1
You can visit Spreadsheet Excel Writer APIs to get more information for exporting.