Saturday, December 29, 2012

To successfully move a Magento store to another host

To successfully move a Magento store to another host (including localhost) you can just follow the steps above.

1. Dump MySQL database.

If you have installed phpMyAdmin- use it. It’s the easiest and fastest way. Go to “Export” tab and select a checkbox named “Save as file”.

If the database is really big or you don’t have phpMyAdmin installed and don’t want to install one, but you have SSH access to the server- then you can use mysqldump tool. The syntax is as follow:

mysqldump -h HOST -u USER -p DATABASENAME > output.sql

If HOST is localhost- you can just type:
mysqldump -u USER -p DATABASENAME > output.sql

After you type this command you will be asked for a password and the process will begin. Grab the output file using for example FTP.

If you have cPanel, Plesk, DirectAdmin or any other web hosting management tool- you can look at the available options. Many panels allow you to dump the database with just a few clicks. For example cPanel does have an option for this.

2. Copy files.

Quite a hard task, because Magento has really a lot of files. You can copy them using FTP, but make sure to enable in your FTP client copying of many files at the same time (for example 5). This will speed up the process a bit, but it can still take a few hours.
If you have SSH access you can log on your server and try to zip/tar all the files.
To use tar type:
tar -cvf myarchive.tar *
To use zip:
zip -r myarchive.zip *
Enter both commands in your site’s main directory (public_html, httpdocs, share/www or similar).
Now you can copy the archive using even FTP. You can also use wget to get it onto another server. Enter this command on the destination server:
wget http://OLDSERVER/myarchive.zip

3. Put the files on your destination server and edit the app/etc/local.xml file. Enter in it access credentials to your new database.

Change MySQL Database Settings
/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>
-----------------------------------------------------------
Go to your \app\etc\local.xml, find default_setup section and add <initStatements> tag with your query there (or change if it is already present). So, it will look like:
<default_setup>
    <connection>
        <host><![CDATA[your_host]]></host>
        <username><![CDATA[user]]></username>
        <password><![CDATA[password]]></password>
        <dbname><![CDATA[db]]></dbname>
        <initStatements><![CDATA[SET NAMES 'utf8' COLLATE 'utf8_unicode_ci']]></initStatements>
        <model><![CDATA[mysql4]]></model>
        <type><![CDATA[pdo_mysql]]></type>
        <pdoType><![CDATA[]]></pdoType>
        <active>1</active>
    </connection>
</default_setup>


(First try to import without following code if error then put following)
4. Before loading the database file add these before the begginning of your SQL dump file:


SET SQL_MODE=”NO_AUTO_VALUE_ON_ZERO”;
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 this after all the contents of this 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;

You can import the database using phpMyadmin (“Import” tab) or mysql tool.
To use mysql tool type:
mysql -h HOST -u USER -p DATABASE_NAME < output.sql
and enter the password when asked.

5. If your Magento is going to work on another domain you need to enter new domain’s name in the database.

Go to table named core_config_data and loof for records with these values in “path” column:
web/unsecure/base_url
web/secure/base_url

Then edit value of column “value” for both records.
Your Magento should already work on another host.


Information Source: http://de77.com/other/how-to-move-magento-shop-to-another-host


Tuesday, August 21, 2012

Upload your Outlook Emails to GMail


I swore this blog was not about “lifehacks” or productivity tools…but when I searched for how to do this task, I found outdated advice on lifehacker, so I had to write my own…

Suppose that you have decided to embrace the web, so to speak, and want to use Google Mail to replace your existing desktop-based Outlook. In my case, I have Verizon downloading to Outlook 2003. Sometimes I use their terrible netmail to access my email remotely. I also have my phone set up to download new mail. Annoyances abound but the key limitations are:
If I forget and leave the outlook client open on my home pc, then all new mail is immediately downloaded there, so I can’t see it on my phone or via the web form.
Once the mail is in my desktop client, I lose the ability to reply to people or access the history of conversations remotely.
The verizon netmail client is buggy; countless composed emails have been lost due to session timeouts.

I determined that I could use GMail and set it up to fetch my verizon mail into the GMail account, and I could also configure GMail to send emails from my verizon account. But I really wanted to upload all the old email and contact information into GMail to make the search and contact stuff useful.

I found an article on lifehacker, but it’s a mess. Some guy wrote a tool that will upload mBox formatted email (what’s that?) from Thunderbird (what’s that?). So, you can download another tool to convert your .pst files into mbox format…yuck. Headache city. Then, I did more searching and found this longer article that takes a long time to describe what is actually a fairly simple and brilliant workaround.

Microsoft Outlook allows you to set up multiple email accounts with multiple protocols. For example, you could have an Exchange mailbox (work) and a POP-based server (home). You could also attach Outlook to an IMAP mail server…Google supports IMAP for accessing the othwerwise web-based email. So here is the solution:

Enable IMAP support in your Gmail account, then add that account to your Outlook client. Then, drag and drop the email from your existing accounts into GMail.

Here is the step-by-step how-to:

Configure GMail  to use their Mail Fetcher to retrieve and send mail through your POP account (e.g. verizon):
1. Login to GMail
2. Click on the Settings link at top right
3. Click on Accounts tab
4. Under “Get mail from another account” click “add…”

see the Mail Fetcher link above for help

Note the checkbox to “leave mail on server.” When you are ready to have GMail be your primary mode of email, you will want to uncheck that box so the mail does not accumulate at Verizon (because you will no longer be running Outlook and downloading it.).

This step achieves what I already had on my phone and through the Verizon netmail. Now to do the fun stuff.
Enable IMAP in GMail: Settings, Forwarding and POP/IMAP tab, Enable IMAP.
Now, open Outlook and add a new account:
choose Tools, Email Accounts to start the wizard
select Add a new email account, Next
choose IMAP, Next

To complete these configuration screens, you should consult the documentation on the google site for your particular Outlook (or other) client. See these configuration instructions from Google, or more help on IMAP from Google

When you complete and finish the new account wizard, you will see a new folder icon for imap.google.com at the top level of your Outlook folders. Now, you can exlore that folder, just like any other, and move email messages back and forth.

After setting this up, I selected 2000+ emails from my local inbox and dragged them across to GMail, a process that took over an hour to complete over a high speed connection. If you have a large amount of email…do it in manageable chunks. And be judicious about what you move–I just wanted to seed google with the most recent stuff to give me something I could search and tag and start using effectively. I also copied my sent items folder contents to the GMail sent items folder.

Actually using GMail is a subject for another tutorial–and I am sure there are plenty out there. But I found this approach of transferring my email gave me something useful to work with and eased the transition.

Sunday, July 22, 2012

How to Change Joomla Database Prefix

1...Make change.php file with following code and changes according to your new prefix:

----------------------------------------------------------------------------------------
<?php
$db_server = "localhost" ;
$db_name = "type dabase name here";
$db_username = "type dabase username here";
$db_password = "type database password here";

$old_pattern = "jos_" ;
$new_pattern = "type new prefix here_" ;

$session_id = mysql_connect( $db_server, $db_username, $db_password);
if (!$session_id) { die('Connection Failed: ' . mysql_error());}

$query = "SHOW TABLES FROM `" . $db_name . "`" . " LIKE '%" . $old_pattern . "%'";
$result = mysql_query ( $query, $session_id );
if (!$result) {die("Query Failed: " . mysql_error( $session_id ));}

while ( $row = mysql_fetch_array ($result) ) {
$old_table_name = $row[0];
$new_table_name = str_replace ($old_pattern, $new_pattern, $old_table_name);
$query = "RENAME TABLE `".$db_name."`.`".$old_table_name."`"." TO `".$db_name."`.`".$new_table_name."`";
if (mysql_query ( $query, $session_id )) {
echo "$old_table_name renamed to $new_table_name <br />";
} else {
echo "Error: $old_table_name not renamed" . mysql_error( $session_id ) . "<br />";
}
}
mysql_close( $session_id );
?>
------------------------------------------------------------------------------------------

2...Open this file into the browser

3...Go to configuration.php file and change
     var $dbprefix = 'new prefix_';



You are done.......:)

Thursday, May 24, 2012

How To Get Web Design Clients Step-By-Step

Fellow Internet marketer and a great guy, Justin Brooke of SiteFling.com wrote this amazing article on a step-by-step system for getting web design clients. I really loved his approach and strategy here. What I really liked about it was that you don’t even have to be a website design expert to do this as you can outsource the work.

This is a great system for how to make money online as an Internet marketing consultant for local businesses in your area. Enjoy this powerful article.

The important thing is that you take action on this system!

The System

Forgive me if this seems kind of short from here, but it’s a pretty easy system. Please don’t mistake it’s brevity and simplicity for less effectiveness. Sometimes it’s the so-simple-why-didn’t-i-think-of-that systems that are so great.

1.First you are going to look for some local businesses that have websites. Which is much easier today then it was when I started this in 2005. Now you can search Myspace, Facebook, Twitter, and many other sites.Once you find the businesses with the websites find 5 or 6 that look like they were designed a long time ago or could really use some improvements. This shouldn’t be too hard since most local business websites are horrendous.

2.Next you are going to pick one of them and re-design their website (or higher someone on scriptlance for $50 – $150). Make sure you take notes as you redesign the site about your reasons for different colors, navigation, buttons, functions, and anything else you change. You’ll need those notes in just a minute.

3.Now that you are finished you call up that company and say… “Hi, my name is Justin Brooke and I’ve redesigned your web site for free and I’d like to show it to someone. Who would that be?”

The gatekeeper won’t be used to this response and will usually be confused enough to just pass you on to the owner/CEO or the right person to talk too. If not just ask for a way that you can make sure he see’s your re-design without taking up his time like an email, fax, or OMG “Snail Mail.” Just make sure you get a way to get your design in front of the decision maker.

4.Once you get the decision maker on the phone you are going to introduce yourself and use this little script that I perfected over the years. “Hey Bob, thanks for taking the call this will be real quick because I know you’re busy. I’ve redesigned your website and I’d like to show it to you. This won’t cost you a thing and you are under no obligation to buy. I just want to show it to you and if you like it you can buy it. If you don’t then we go our separate ways with no harm done. Would Tuesday or Thursday be best?”

That’s it…

Just keep in mind that you aren’t selling anything on this phone call, just getting an appointment. After you ask for the Tuesday or Thursday… SHUT UP! Silence is the strongest sales tool you’ll ever experience because it forces the person on the other end of the call to make a decision.

Seriously, I don’t care if you have to wait 45 minutes, DO NOT be the first person to talk or you will relive their pressure and possible lose the appointment. People are much more comfortable with saying yes then they are saying no so usually they agree to the appointment.

After all it’s free, they have no obligation to buy, and you’ve just redesigned their website… They want what you have.

Closing The Deal At The Appointment

We would then setup the appointment and I would either show them via remote desktop sharing (webinar) software or in person. I would explain all the reasons for my changes and the benefits of the re-design (those notes I told you to take). They would naturally ask how much for the design and I would start off with $2,500 but say that I can work with their budget if they needed a sliding scale.

Then, I would say that I needed a decision in a week though because otherwise I would have to delete theirs. That I only get paid when I sell one of these re-designs, so I can’t afford to wait on them forever.

The urgency along with the sliding scale discount really helped nail down the sales and create impulse buys. Finally I told them that I accept checks through my bank and credit cards thru Paypal.

This system worked just fine until I ended up pursuing other interests like blogging and information marketing. Feel free to use this system exactly as I’ve mentioned to create your own web design business.

What Would I Change Today

If I were to pick this business back up, and I’m very tempted too, then I would most likely outsource the whole thing.

I would hire designers from Scriptlance and pay them either weekly or per project. Then I would hire sales reps from Craigslist and pay them on a commission only structure. The designers would get about 25% of the project and the sales rep would get 25% for each design he sold. Leaving me with 50% for just managing the business.

If the sales rep sold more then 4 designs in a month then I would give him a bonus 10% on his sales to give him an extra incentive to perform at his best.

Well I hope you’ve liked this little peak inside how I do things. If you are the type that likes the “Offline gold” or “Offline to Online Riches” reports out there then you’re really loving this, because this is the real deal.

This is how I put food on the table for quite awhile when I was just starting out.

If you have any questions or just want to tell me you liked this post then please do in the comments down below. I’ll stick around for a few days answering every comment.

Article Author: Justin Brooke, SiteFling.com

Wednesday, January 4, 2012

Create your own Dynamic DNS Service using PowerDNS and MySQL

Dynamic DNS services can be very useful for sites or servers with dynamic IP addresses. Most residential Internet providers will only provide you with a dynamic IP address, making it quite difficult to manage systems remotely. This problem can be remedied with the use of Dynamic DNS where a software client updates the DNS server with the latest IP address of the site. Many providers already exist which provide this service such as No-IP.com or DyDNS.com. These are good, but unfortunately not all of their features are free and they require you to log in every once in a while to make sure that your account doesn’t get deactivated. In this article, I’m going to show you how you can setup your own Dynamic DNS service using PowerDNS and MySQL to update your dynamic sites’ IP in your own DNS server.


Instructions

These instructions assume that you have a domain name (purchased from a provider such as GoDaddy or otherwise) and you have the ability to point your domain to your own name servers.




Step 1

Install PowerDNS and its dependencies for MySQL.

Ubuntu / Debian

sudo apt-get install pdns-server pdns-backend-mysql mysql-server

CentOS / RHEL / Fedora


yum install pdns pdns-backend-mysql mysql-server



Step 2

Configure PowerDNS with your MySQL details.

sudo nano /etc/powerdns/pdns.d/pdns.local

# Here come the local changes the user made, like configuration of
# the several backends that exist.

gmysql-host=127.0.0.1
gmysql-user=<mysql user>
gmysql-password=<mysql password>
gmysql-dbname=<powerdns database>



Step 3 (Optional)

You can optionally install a web frontend to manage your domains. I recommend PowerDNS Administrator.
http://code.google.com/p/pdnsadministrator/downloads/list



Step 4

Configure the update script to update the DNS record in the database.

sudo mkdir -p /opt/dynamic-dns

sudo nano /opt/dynamic-dns/update.php

<?php

$ip = $argv[1];
$domain = $argv[2];


// Make MySQL Connection
mysql_connect("localhost", "powerdns", "a4031b869c") or die(mysql_error());
mysql_select_db("powerdns") or die(mysql_error());

// Update record in database.
$result = mysql_query("UPDATE records SET content='$ip' WHERE name='$domain' and type='A';")

?>


Step 5

Install openssh-server and openssh-client in both servers.

sudo apt-get install openssh-server
sudo apt-get install openssh-client

Configure SSH Keys on the dynamic host for passwordless authentication to the DNS server. Be sure to change the <user> and <powerdns ip>
to the correct values.

ssh-keygen (Accept all the default values.)

cat ~/.ssh/id_rsa.pub | ssh username@hostname 'cat >> .ssh/authorized_keys'



Step 6

Configure the client script/cron job to fetch the dynamic host’s current IP address and update the DNS database. Be sure to update the bold values with the appropriate values.

sudo nano /etc/cron.hourly/dynamic-dns.cron && sudo chmod +x /etc/cron.hourly/dynamic-dns.cron

#!/bin/bash
IP=`curl -s http://www.whatismyip.org`
DOMAIN=<dynamic dns domain>
ssh -C <user>@<powerdns ip> php /opt/dynamic-dns/update.php $IP $DOMAIN
echo “`date` $DOMAIN – Updated IP to $IP” >> /var/log/dynamic-dns.log