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.

Path variables in PHP

Many of you develop php applications for multiple server environment. Webserver environment may be different, have different directory structure, so you have to use paths very carefully. For example in file upload script, you manually write absolute path of image directory, the application may not work on other server. To avoid this you should use inbuilt php path variables. I am posting summary of all php related path variables.

Operation: Extract file name from path
Function: string basename ( string $path  [, string $suffix  ] )
Example:
$path = /opt/lampp/htdocs/demo/test.php;
echo basename($path);
Output: test.php

Operation: Get web server root path
Variable: $HTTP_SERVER_VARS[“DOCUMENT_ROOT“]
Example:
echo $HTTP_SERVER_VARS[“DOCUMENT_ROOT“];
Output: /opt/lampp/htdocs

Operation: Get current script full path (including document root path)
Code: $HTTP_SERVER_VARS[“SCRIPT_FILENAME“]
Example:
echo $HTTP_SERVER_VARS[“SCRIPT_FILENAME“];
Output: /opt/lampp/htdocs/test.php

Operation: Get current script name (relative to root)
Variable: $HTTP_SERVER_VARS[“PHP_SELF“]
Example:
echo $HTTP_SERVER_VARS[“PHP_SELF“];
Output: test.php

Operation: Get current script name (relative to root)
Variable: $HTTP_SERVER_VARS[“PHP_SELF“]
Example:
echo $HTTP_SERVER_VARS[“PHP_SELF“];
Output: test.php

Operation: Convert relative path to absolute path
Function: string realpath ( string $path  )
Example:
echo realpath(‘../images’);
Output: /opt/lampp/htdocs/images

Operation: Get all file details
Function: mixed pathinfo ( string $path  [, int $options= PATHINFO_DIRNAME | PATHINFO_BASENAME | PATHINFO_EXTENSION | PATHINFO_FILENAME  ] )
Example:
$info = pathinfo($_SERVER[‘PHP_SELF’]);
print_r($info);
Output:
Array
(
[dirname] => /abhi
[basename] => EmptyPHP.php
[extension] => php
[filename] => EmptyPHP
)

DISQUS: Aggregate your comments over the web!

DISQUS is a great service to aggregate your comments all over the web. If you add a comment on a blog / website which is using this system, your comment will be visible in to your DISQUES account as well in post. This way you can keep track of your all comments. Another cool feature is, you can subscribe comment RSS.

For webmasters, It is extremely easy and installed in 5 minutes. There is a plugin available for DISQUS. I recently integrated it into myblog and it took hardly 5 minutes!

Try this and I am sure you will like it!!

cheers 🙂

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

Hack Windows 7 with Vbootkit 2.0

A proof-of-concept security exploit in Microsoft?s Windows 7 operating system has been released by Indian security researchers. The exploit has been named as VBootKit . The researchers had earlier promised that they would not make the exploit code public for fear of misuse. VBootKit 2.0 was coded by researchers Nitin Kumar and Vipin Kumar; and the code is now available as open source for anyone who is interested to see how it works. The researchers released the proof-of-concep

Read Full Story