Friday, July 24, 2009

Convert excel to CSV file using PHP, Linx Server

How to convert xls file into csv file using php or LAMP, Look at simple example to convert excel to csv file using php on linux server.

require_once 'Excel/reader.php';
$excel = new Spreadsheet_Excel_Reader();
$sep = ",";
while($x<=$excel->sheets[0]['numRows']) {
while($y<=$excel->sheets[0]['numCols']) {
$cell = isset($excel->sheets[0]['cells'][$x][$y]) ? $excel->sheets[0]['cells'][$x][$y] : '';
echo $row."\n";
$fp = fopen("data.csv",'w');

You can download reader.php file from

Thursday, July 23, 2009

Set php.ini values into .htaccess file

How can i set php.ini configuration values into .htaccess file? Here is the simple solution to set php.ini variables into .htaccess file.

Syntax non flag variables.
php_value setting_name setting_value

Example :
php_value upload_max_filesize 10M

Syntax for flag variables such as (on/off).
php_flag [variable_name] [value]

Exmaple :
php_flag register_globals off