Invalid command ‘Header’, perhaps misspelled or defined by a module not included in the server configuration

March 7, 2012  |  4 Comments  |  by Raj (MagePsycho)  |  Apache, Latest, Linux, Magento

I got the following error for one of the Magento e-commerce website:

Invalid command โ€˜Headerโ€™, perhaps misspelled or defined by a module not included in the server configuration

After googling it was found that related headers module was not enabled in Apache.

I was able to fix the issue simply by following two commands:
1. Enabling headers Module

ln -sf /etc/apache2/mods-available/headers.load /etc/apache2/mods-enabled/headers.load

2. Restarting Apache

/etc/init.d/apache2 restart

Note: Above commands were run from Ubuntu 10.04.2 server

Hope this’s helpful.

Unzipping archive files using SSH

December 2, 2011  |  No Comments  |  by Raj (MagePsycho)  |  Latest, Linux

Extracting archive file depends on the type.
Here goes the list of extracting/unzipping command for various archive types:

1> Unzipping .zip file


2> Unzipping .tar file

tar -xvf filename.tar

3> Unzipping .tar.gz or .tgz file

tar -zxvf filename.tar.gz
tar -zxvf filename.tgz

4> Unzipping .gz file

gunzip file.gz

5> Unzipping .bz2 file

bunzip2 file.bz2

Let me know if you have any unzipping command for new file type.

Thanks for reading.

Upgrading Magento from to via diff file

November 10, 2011  |  4 Comments  |  by Raj (MagePsycho)  |  Latest, Linux, Magento

Uprading in Magento has never been an easy task for me. But this time I successfully upgraded the Magento(from to with minimum no of tries. And I’m going to share the success story ๐Ÿ™‚

First, I tried with the following series of SSH commands but unluckily didn’t work for me:

rm -rf var/cache var/session
rm -rf downloader/pearlib/cache/* downloader/pearlib/download/*
rm -f downloader/pearlib/pear.ini
chmod 550 ./mage
./mage mage-setup .
./mage config-set preferred_state stable
./mage list-installed
./mage list-upgrades
./mage install Mage_All_Latest --force
php shell/indexer.php reindexall

I went through all the above steps successfully but when i tried to logout and re-login at the backend, version number didn’t change in the admin footer. It means there was no effect of above code at least for me.

After that I tried the following SSH commands:

rm -rf var/cache/* var/session/*
rm -rf downloader/pearlib/cache/* downloader/pearlib/download/*
rm -f downloader/pearlib/pear.ini
zcat >
patch -p0 -f <

– Deleting pear.ini is important in case If you have copied the same magento from another location. Else updates will be installed in your source location instead of current location.
– You need to run the above commands from the root of your Magento installation.

After successfully applying the above commands, I refreshed the magento page but got the following error:

“Error in file: “…/app/code/core/Mage/Sales/sql/sales_setup/upgrade-” – SQLSTATE[42S01]: Base table or view already exists: 1050 Table ‘sales_order_aggregated_updated’ already exists”

and this error was easily removed just by renaming the following file:


Besides i didn’t get any error and hence upgrading Magento task was successfull.
This is the first time i upgraded via applying the .diff file and was so happy that it worked for me ๐Ÿ™‚


Happy Upgrading!

How to run Magento 1.3.X on PHP 5.3?

October 15, 2011  |  1 Comments  |  by Raj (MagePsycho)  |  Linux, Magento

You know that Magento version (>= 1.4.X) works well under PHP 5.3. But what if you want to run the Magento 1.3.X under the same AMP(Apache/Mysql/PHP) package? You may need this in order to test the extension/theme compatibilities.

In order to run Magento 1.3.x on PHP 5.3, you need to replace the following function from the corresponding files:

1> index.php

error_reporting(E_ALL | E_STRICT);


error_reporting(E_ALL & E_STRICT & ~E_DEPRECATED);

2> lib/Varien/Object.php




3> lib/Varien/Pear.php

error_reporting(E_ALL & ~E_NOTICE);


error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);

4> downloader/Maged/Pear.php

error_reporting(E_ALL & ~E_NOTICE);


error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED);

5> app\code\core\Mage\Catalog\Model\Layer\Filter\Price.php




6> app\code\core\Mage\Core\Controller\Request\Http.php




7> app\code\core\Mage\Catalog\Model\Category\Attribute\Backend\Sortby.php




8> app\code\core\Mage\Admin\Model\User.php




Let me know if i missed some points.

Note that such core hack will be only suitable for testing purpose in development server only, So please bear that in mind.

For terminal user who just want to apply patch, i would recommend to use the following article:

Hope this helps you.

Happy E-Commerce!!

Export / Import CMS pages / Static Blocks Via SSH

October 10, 2011  |  4 Comments  |  by Raj (MagePsycho)  |  Linux, Magento, Mysql

It’s really a tedious task when you have to copy all the cms pages / static blocks from your development server to the live server. If you are importing the whole database then you are lucky enough but if you are updating in already installed magento server then :(, luckily you can use the following commands via SSH:

1> Export from your development server:

mysqldump -u [username] -p[password] [database] cms_page cms_page_store cms_block cms_block_store | grep INSERT | sed 's/INSERT INTO/REPLACE INTO/' > cms-export.sql

Note: Don’t forget to add prefix to cms_* tables if you have prefixed your tables.

2> Import to your live/destination server:

mysql -u [username] -p[password] [database] < cms-export.sql

Hope this saves your time while copying cms pages & static blocks.

Let’s share if anyone has better idea.

Happy E-Commerce!!