Showing posts with label Magento. Show all posts
Showing posts with label Magento. Show all posts

Monday, September 23, 2013

Magento pre-checks – how to install curl, gd, mcrypt, and pdo using cpanel whm

I searched for hours and hours after I attempted to install Magento on a godaddy vps only to get this:
Your server does not meet the following requirements in order to install Magento.
The following requirements failed, please contact your hosting provider in order to receive assistance with meeting the system requirements for Magento:
  • You are missing the curl extension
  • You are missing the gd extension
  • You are missing the mcrypt extension
  • You are missing the pdo_mysql extension
  • You are missing the pdo extension
The following requirements were successfully met:
  • You have PHP 5.2.0 (or greater)
  • Safe Mode is off
  • You have MySQL 4.1.20 (or greater)
  • You have the dom extension
  • You have the hash extension
  • You have the iconv extension
  • You have the pcre extension
  • You have the simplexml extension
After hours of searching I found “pecl install pdo” which worked great to address the pdo and pdo_mysql extension issues.  But sadly, “pecl install curl” did nothing (btw, its not supposed to – but I was hopeful).  I found a lot of information about updating the php.ini – most of which talked about removing the ; from the lines required to enable curl, gd, and mcrypt.  Which I did – then restarted apache, then restarted my server, then rebooted my laptop… ok, the laptop was because I loaded patches to it completely unrelated to my server problem, but why not throw that in there?
I found several posts saying “just run /scripts/easyapache”.  Most of these posts assume a certain level of knowledge that I obviously didn’t have.  Once I found that I can actually just type “/scripts/easyapache” at an SSH command line (I know I may have just ‘assumed’ a level of knowledge you may not have but keep reading, it gets easy!)  I ran easyapache and was presented with a text based menu that made no sense to me.  I felt like I was on the right track, but still not there.  The forum where I found the easyapache hint (http://forums.theplanet.com/index.php?showtopic=26527) had several comments with questions about what it does and how to use it – but one comment caught my eye by Erwin:
In CPanel 7, you can now do this in WHM by going to the Software section and choosing: Update Apache
Then choose mcrypt or any other module you want to recompile PHP with.
And it will do so automatically. icon_smile.gif Similar to easyapache, but easier to use. icon_smile.gif I upgraded to PHP 4.3.2 just like that with the modules I want.
So I tried that – realizing the post was pretty old and my screens might be very different.  They were, but I was able to work it out. I went to
  • “Main >> Software >> EasyApache (Apache Update)”.
  • Then I selected the PHP Encryption / E-commerce option.
  • Then “start customizing based on profile”.
  • From there I selected Apache 2.2 (I was currently running 2.0),
  • clicked Next and selected php5, selected build 5.3.2,
  • scroll to the bottom of the page and click “
  • Now we are COOKING! – you can now select curl, gd, mcrypt, pdo, and a whole host of other options.
After selecting those options, I clicked ““.  Now it goes and goes while building apache with all of the options you selected – NO COMPILING, MAKE, MAKE INSTALL, ETC!  It does all of that for you!
I go back to my magento-check.php page and I’m in magento precheck heaven:
Congratulations! Your server meets the requirements for Magento.
  • You have PHP 5.2.0 (or greater)
  • Safe Mode is off
  • You have MySQL 4.1.20 (or greater)
  • You have the curl extension
  • You have the dom extension
  • You have the gd extension
  • You have the hash extension
  • You have the iconv extension
  • You have the mcrypt extension
  • You have the pcre extension
  • You have the pdo extension
  • You have the pdo_mysql extension
  • You have the simplexml extension

Sunday, February 10, 2013

How to Migrate Magento Products into K2 Items (Joomla)

Whenever we need to transfer any database from one program to another program, we just need to study the Targeted program Tables (schema) then we have to transform our data according to targeted tables (schema) by following this approach we can transfer any data into any program as I have done with
Magento to K2 joomla transfer.


How to Migrate Magento Products into to K2 Items (Joomla)
-------------------------------------------------------------------

1..Go into joomla database from phpmyadmin and open k2_items table and see how many field are there.
 
2..Make an excel file and type all field name into columns.

3..paste at least one record for all fields from phpmyadmin (so you will be able to examine the   

recording format.)

4..you may have to make extra filed in K2 to match you data fields in magento.
  
3..Export all Product from Magento back-end panel from Export.
   (if your database is too big so you can partially export products then
    import all in excel)

4..sort all your magento product in excel by using filter and delete unnecessary columns.

5..Now we need to prepare our k2_items tables.
(MS Excel filter is the best tool for transforming data that I use mostly)


(in K2_items records you will see that extra fields records are enter in "one" field with code

[{"id":"16","value":""},{"id":"17","value":"1"},{"id":"19","value":"3137 Lorna Rd"},

{"id":"20","value":"Birmingham"},{"id":"21","value":"35216"},{"id":"22","value":"1"},

{"id":"23","value":"(205) 822 8224"},{"id":"24","value":""},{"id":"25","value":""}]    


the above mention code filed name are as below for example: (your field name will be different)

Contact Person: [{"id":"16","value":"Rameez"},
State:         {"id":"17","value":"29"},            (this is drop down list 29 is for Hawaii)
Address :    {"id":"19","value":"230 Highway 34"},
City:        {"id":"20","value":"Aberdeen"},
Zip Code:    {"id":"21","value":"07747"},
Country:    {"id":"22","value":"1"},
Phone1:        {"id":"23","value":"732-290-1900"},
Phone2:     {"id":"24","value":"732-290-1901"},
Email:        {"id":"25","value":"rameez@aol.com"}]
(you can see the IDs and name of extra field from the record easily by K2 Items in backed)


So you will have to make this code by using excel merge columns technique as follows)

    Merge columns of data without spaces between the data: =A1&B1&C1&…
    Merge columns of data with spaces between the data: =A1&" "&B1&" "&C1&…

see following link for a better understanding
http://www.extendoffice.com/documents/excel/510-merge-columns-keep-data.html


6..copy and paste all Magento product filed into corresponding filed of K2 accordingly.

7..copy and paste all others default values of k2 into k2_items columns in each record.

8..save as this excel file into csv format.


9..Now import this file into a k2_items table by using phpmyadmin panel.


Troubleshooting:
--------------------
If you found any error importing csv file into phpmyadmin
THEN save excel file into sql format AND import it again.


the above mention approach is applicable for all manually transfer of databases
From any program to any program.

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