Moving Magento site from development server to live server

Recently I faced problem to move magento site from local (LAMP) environment to web server. I am posting steps to upload site on server.

1. Make tar / zip of code.

$ tar -cvvf site.tar /opt/lampp/magento/

2. Take backup of database through phpmyadmin. Check “Disable foreign key checks” to avoid error in restore process.

3. Open backup sql file and add following

In beginning

SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT;
SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS;
SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION;
SET NAMES utf8;
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=’NO_AUTO_VALUE_ON_ZERO’;
SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0;

and following in the end of file

SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT;
SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS;
SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION;
SET SQL_NOTES=@OLD_SQL_NOTES;

4. Upload tar / zip file on web server, extract and deploy. Don’t forget to clear cache (Clear /var/cache and /var/session directories).

tar -xvvf site.tar

5. Change /var permission to 777 recursively.

$ chmod 777 /home/magento/htdocs/var

6. Restore database on server through phpmyadmin.

7. Change mysql database setting in

/app/etc/local.xml

<connection>
<host><![CDATA[localhost]]></host>
<username><![CDATA[database_username]]></username>
<password><![CDATA[database_password]]></password>
<dbname><![CDATA[database_name]]></dbname>
<active>1</active>
</connection>

8. Run website.

If you are getting blank page then check the following

1. Mysql Database setting.

2. Did you clear cache?

3. Followed step3?

If you are getting Undefined index 0 Error then check the following

1. Did you followed step3?

2. Or you can manually run these queries

UPDATE `magento`.`core_website` SET `website_id` = ‘0’ WHERE `core_website`.`code` = ‘admin’  LIMIT 1 ;

UPDATE `magento`.`core_store` SET `store_id` = ‘0’ WHERE `core_store`.`code` = ‘admin’ LIMIT 1 ;

Clear cache as you make any change.

Advertisements

Installing a minimal Debian system

lennybanner_indexed

I am making this post for users with limited computer resources/old machines. Users with newer and faster machines may also try this if they want their completely customized operating system.

I must also clarify that I personally don’t like bloatwares like Windows Vista etc.

Take my example, when I first installed Ubuntu on my desktop, I had a complete GNOME desktop with many applications pre-installed which I had no use for! So, I started uninstalling that bloat from my system to make my OS slim so that it can run properly on my good ol’ pentium 4 1.7 Ghz machine.

However, uninstalling those extra useless apps didn’t help me much. My Linux system was still bloated and running slower than Windows XP.

Right then, I researched over internet and found a solution to my problem.

What is needed:

  • An internet connection (for downloading packages)
  • Atleast 2GiB of HDDSpace
  • Some spare time
  • And obviously you 😉

Get the netinst disk image from the link according to your system architecture. If not sure, then go with the i386 image. Now burn the image to a CDROM and boot your system with it. Continue with the installation and select all options that apply to you and keep an eye out for a dialog box asking about using a network mirror. When this screen comes up, choose No. Choose to install GRUB and let the install finish.

Now, when your computer restarts, choose debian and boot into it. When you get to the login prompt, login as root.

We need to modify the repositories list for your system.

Type:

Code:

nano /etc/apt/sources.list

And put this into the file:

Code:

deb http://ftp.debian.org/debian lenny main contrib non-free

Make sure to comment out the CD-ROM repository entry by putting a number sign (#) in front of it, like this:

Code:

# deb cdrom:…

Later, if you want to add an official debian installation disk (or if you don’t want to use internet for packages), just insert the disk in drive and type:
Code:

apt-cdrom -f -add

Save it (Ctrl+O) and exit (Ctrl+X) and type in:
Code:

aptitude update

This will update the repositories list. Once you it’s done, we’re going to install the base core files needed to run a visual desktop environment, or just the desktop. As an example, we’ll use GNOME, so type in:

Code:

aptitude install xorg gnome-core gdm

This will setup the XOrg server, GNOME core files and the GNOME Display Manager onto your machine. If you want KDE, type:

Code:

aptitude install xorg kde-core kdm

Now, for the Display Manager (login manager), you can use a very limited, simplistic one. Instead of gdm/kdm, use slim.

After all that is done, reboot and let it start up. You’re set! Now you can install a File Manager, Web Browser, Music player, etc of your choice.
For even more lighter system, LXDE can also be tried. And if you want an extreme lightweight system, do not install any desktop environment. Instead just install a windowmanager like fluxbox/openbox etc.

Make free internet calls (Google, skype, MSN, SIP, WeFi) from your mobile

Symbian Smart Phones are very popular these days. A lot of hot applications are in market for symbian platform. Thanks to Nokia for creating this platform. Now I am going to tell you about a very useful application of smart phone, If you are a freelancer (like me), CEO and other marketing executive, have to remain online all the time for customer inquiries, then I am sure you will like this application.

Go to http://www.fring.com/ download in install application in your phone. Run this application. It will ask you for permissions, allow all permissions and continue. Now you will be asked for subscription Skype, Gtalk, MSN etc, select desired services and enter login details. Done!

Now you can call buddies from fringe. The call quality is very goon even in EDGE network. Few fetures are as follows

  • Voice calls and chat over 3G and Wi-Fi
  • Skype and Google Talk integration (Voice and Chat)
  • History (Missed calls, Incoming/Outgoing calls)
  • Good voice quality

Hope you will enjoy fringe. Don’t forget to call me my ID is abhinavzone

Manage linux server from your SmartPhone

Today I am going to write something very interesting, Suppose you are enjoying holiday and suddenly one of your visitor call you and inform you that your Database Server is not responding.. You are in hill area and do not have have any cyber cafe around.. hmm?

I tell you the gr88 solution. Download Putty for your smart phone (I have Nokia 5800) and install. Through this application you can execute linux command from your phone console to your server. To use this with your server you must have Static IP of server and SSH access of server.

Note for Indian users: If you are using GPRS Mobile (Internet on mobile) package, then this application may not work. Because operators block all ports other than 80 (http) in case of GPRS Mobile (Internet on mobile) packages. To avoid this you have to activate GPRS Internet on your mobile.

I am using IDEA, GPRS Internet for Rs. 249.00 / month (unlimited download).

let me know if you have any problem 😉

Cheers

Large File Upload

Recently I faced a big problem with large file uploads. One of my client has a Centos5  dedicated server. I created a script for Video upload and conversion. I also added a progress bar to show file upload progress. This progress bar has limit of 100MB because of flash limitation. Everything was working fine for files less than 50MB, but as size grows the upload hangs on 20 – 30%.. I did every thing in php.ini and apache.conf but nothing helped. I wrote to server admin at least 50 times and finally they giveup! Now I has no solution.

I start searching on net and found uberUploader. This is the most comprehensive uploader available on net. You don’t even need to set php.ini settings, because the uploading part handled by Perl. This resolved my problem. Now I can upload 1GB file This has a bunch of uploading configuration option. This also has nice progress bar.

Finally end of 1 month long problem.. Thanx uberUploader!!

jQuery and Me…


I use mootools for all JS related tasks. Mootools is good library but has very limited support and few plugin available on net (most of you are not agree of this but it’s my openion based on 2 year exp with mootools) .

So I decided to move on to another framework. There is many JS toolkits available.

Dojo
jQuery
Prototype
YUI
etc.. much much more

But these are key players. I selected jQuery among these frameworks.. Why? because It has gr8 support good community and top of all, has rich plug-in directory.

To go through jQuery I am reading Learning jQuery 1.3 By Jonathan Chaffer and Karl Swedberg. Its comprehensive book for beginners. I recommend you to read that if you want to play well with jQuery.

jQuery has rich set of selectors. you can also define custom selectors. jQuery has unique chaining support which makes development faster. I hope the jQuery and me will cover a long distance togather. Let’s see… 😉

flv, ffmpeg and PHP: File conversion

Hi friends,

2 days ago I got a project in which I have to upload avi, mpeg or 3gp movie clip and convert this clip to flv as well generate thumbnail for this video. I know that this can be done through ffmpeg. But I didn,t know how haha..

Well I searched enough and start making environment for development. I did following mistakes.. I am listing those  mistakes. I am 100% sure it will save your day.

I was using Windows environment: FFmpeg is primarily made for Linux environment not for windows. Some experts developed windows version of ffmpeg.  Some functions are unavailable in windows version. SO I suggest you to use Linux environment.

I thought that only ffmpeg can do everything: FFmpeg is a command line tool to do video related task (only video) such as clipping, video conversion, frame extraction etc. But for the sound, watermarking you have to use other packages too. I will tell about these details later.

php-ffmpeg and ffmpgeg: I was very much confuse between php-ffmpeg and ffmpeg. I after 30 minutes of googling I came to know that ffmpeg-php is extension for php which provide handy functions to convert videos and if you use ffmpeg then you have to use exec() command to execute ffmpeg commands.

Step by step procedure to convert video:

1. Setup Linux system.. forget that windows can do the job!

2. follow instructions and install all required modules. here is comprehensive step by step procedure available http://vexxhost.com/blog/2007/03/03/installing-ffmpeg-ffmpeg-php-mplayer-mencoder-flv2tool-lame-mp3-encoder-libogg-%E2%80%93-the-easy-way/ . if you face any problem then you can ask me.

Remember: Installation order  LAME->FFmpeg->Ruby->FLVTool2

3. Now you have successfully setup environment. Download any example from net and run.

The  best thing I got is videotoolkit you can download it from Here . It saved my day. you can also try it. It’s really worth to try this!

Hope this article will helpful. If you still have any problem then ask.. Happy coding….

SoftException in Application.cpp:303:

Recently I came across following when deploying webapplication on Linux serevr…
SoftException in Application.cpp:303: UID of script “/home/xyz/public_html/en/pupgrade.php” is smaller than min_uid
The problem was file owner and group as root (I was uploading file through root account)
Solution: change file owner and group to webhoting user..  generally it is your user name..
/home/[user]/public_html/en/pupgrade.php

The linux command for this task is

$ chown -R username:usergroup directory

enjoy