Tuesday 29 January 2019

How To Migrate Magento 1 To Magento 2

Step 1 : Get full backup of your Magento 1 store including all files, folders, and the database

Step 2 : Create a clone of your Magento 1 store. Do not use your live store for Magento migration process

Step 3 : Check your store. Keep what you think is necessary and delete the rest

Step 4 : Check whether your current theme(s), extensions and custom code are compatible with the Magento 2 or not.

Step 5 : Create clone of Magento 1 database and connect with new(clone) magento 1.

Step 6 : Remove useless data from the database including logs, recently viewed products, compared products, etc.

Step 7 : To make Magento migration process as hassle-free as possible, install a fresh and latest copy of Magento 2 on the same hosting server where your Magento 1(cloned) store is located.

Step 8 : To find the version of your store, navigate to the root directory of your Magento 2 via SSH and enter the following command:
php bin/magento --version
Step 9 :
composer config repositories.magento composer https://repo.magento.com
composer require magento/data-migration-tool:2.3.0
You will be asked to enter your developer authentication keys. Go to the Magento Marketplace. Sign in using your login credentials, go to your profile and then click Access Keys under My Products section.

If you already have keys then, your public key will be your username and the private key will be your password. Otherwise, create a new key pair by clicking the Create a New Access Key button.

In a few seconds, the Data Migration Tool will be successfully installed on your Magento 2 store.

Configure Magento 2 Data Migration Tool


Step 10 : Goto <Magento 2 root dir>/vendor/magento/data-migration-tool/etc/opensource-to-opensource/<Magento 1.x version> and rename config.xml.dist to config.xml

Step 11 :

Next, open config.xml in your favorite code editor and specify the following:

<source>

<database host="localhost" name="Magento1-DB-name" user="DB-username" password="DB-password"/>

</source>

<destination>

<database host="localhost" name="Magento2-DB-name" user="DB-username" password="DB-password"/>

</destination>

<options>

<crypt_key>Magento1-Encrypted-Key</crypt_key>

</options>

In the above code, <source> has the database information of Magento 1 and <destination> has the relevant database information of Magento 2. <crypt_key> is mandatory and needs to be filled prior run. It is the encryption key of Magento 1 store and can be found in the <Magento 1 root dir>/app/etc/local.xml file, within the <key> tag.

When finished, save the config.xml and you are done.

Migrate Settings Using Magento 2 Data Migration Tool


Here is how you can use the Data Migration Tool to migrate settings from Magento 1 to Magento 2. These settings include stores, websites, system configurations such as shipping, payment, tax settings, etc.

According to the Magento Data Migration Order, you should migrate settings first. To start migrating the settings, navigate to your Magento 2 root directory via SSH terminal and run the following command:
php bin/magento migrate:settings --reset <path to your config.xml>
where <path to your config.xml> this would be vendor/magento/data-migration-tool/etc/opensource-to-opensource/<Magento 1.x version>/config.xml. I have used --reset argument in the above command which forces the Data Migration Tool to start from the beginning.

Once the settings migration is over, a successful message will be displayed.


Migrate Data Using Magento 2 Data Migration Tool


Data migration from Magento 1 platform to Magento 2 platform includes products, categories, orders, customers, wish lists, ratings, etc. To migrate data, run the following CLI command:
php bin/magento migrate:data --reset <path to your config.xml>
As this command runs, the Magento 2 Data Migration Tool saves its current progress, and in the case of an error, stop the process and resume from the last known good state. Also, the Magento 2 Data Migration Tool may report some errors during the migration. In such a case, refer to the Troubleshooting page of the Magento 2 Data Migration Tool for further assistance.

Step 12 : Finish and check Your Magento 2 store


How to install Extension in PHP 7.2 | PHP 7.1 | PHP 7.0 in Ubuntu 16.04 | Ubuntu 18.04

Open terminal or cmd and put following command
apt install php7.2-soap
apt install php7.2-bcmath

Thursday 24 January 2019

How to dump Magento 2 Enterprise Edition Database

  1. curl -sS https://accounts.magento.cloud/cli/installer | php
  2. magento-cloud list
  3. login without root
  4. magento-cloud db:dump
  5. Open login URL in browser like : http://127.0.0.1:5000
  6. Update to version 1.23.0? [Y/n] y
  7. Continue? [Y/n] y
  8. Enter a number to choose a project:
    1.  [0] ProjectName (Project) (tx2ia23dv5uk)
    2.   Environment ID [staging]: (Press enter key)
  9. Enter a number to choose a relationship:
    1.   [0] database
    2.   [1] database-slave
  10. (Press 0 and Enter key) 

Monday 31 December 2018

sql_mode=only_full_group_by is incompatible in PHP mysql query with GROUP BY codeigniter


#1055 - Expression #24 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'customers.first_name' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

Add $this->db->query("SET sql_mode=(SELECT REPLACE(@@sql_mode, 'ONLY_FULL_GROUP_BY', ''));") line above your query.

See Example :
$this->db->query("SET sql_mode=(SELECT REPLACE(@@sql_mode, 'ONLY_FULL_GROUP_BY', ''));");
$this->db->select('*, customers.first_name, customers.last_name, customers.id');
$this->db->select("(SELECT count(video_id) FROM customer_videos WHERE c.customer_id = customer_videos.customer_id AND (created_at >= '$from' OR created_at <= '$todate')) as seen");
$this->db->join('customers', 'customers.id = c.customer_id', 'left');
$this->db->group_by('c.customer_id');
$this->db->from('customer_videos as c');
$query = $this->db->get();
echo "<pre/>"; print_r($query->result());exit;
return $query->result_array();

Thursday 27 December 2018

No space left on device in server | PHPMysql not connect session | Full Inodes 100% | Check CPU Process and MEMORY

Issues
  1. open(/var/lib/php/sessions/sess_, O_RDWR) failed: No space left on device (28)
  2. PHPMysql not connect
  3. Database not connect
Solusions

Check CPU and MEMORY usage of server from terminal
ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%cpu | head
df -h
Check file size
find /home/ -size +100M 

 

 Check INODES in server (Inode mean total files into server)
df -i
Search INODES from system and perticular folder (Get number of file in perticular directory)
for i in /var/www/html/*; do echo $i; find $i |wc -l; done
Check INODES into specific directory
ls -l /var/lib/php/sessions | wc -l
Remove all files from specific directory
rm -r /var/lib/php/sessions/ 
If you are using PHP so you can create code in any existing file
$path = '/var/lib/php/sessions/';
$dir = opendir($path);
$i = 0;
while ($dir && ($file = readdir($dir)) !== false) {
    unlink($path.$file);
    echo $i.' - '.$path.$file.'<br>';
    if($i == 50000){
        exit;
    }
    $i++;
}

Friday 21 December 2018

How to create snapshot and attach with another instanse

  1. Stop current instanse
  2. Create new Snapshot (Please check volume properly) from current volume
  3. Create new instanse with greter or equal to current volume (GB) from old instanse
  4. Stop New instanse
  5. Goto spanshot and create volume with (us-east-1d)
  6. Goto volume and detach currnet volume of new instanse
  7. attach new volume which you have created from snapshot (us-east-1d) make sure same root (/dev/sda1)
For your ref : https://www.youtube.com/watch?v=W89C_OqlOwE

Thursday 13 December 2018

How to generate new SSH key and adding it to the ssh-agent

1. Open Terminal
2. Paste the text, change email address. $ ssh-keygen -t rsa -b 4096 -C "jaydipkansagra@example.com"
3. Enter a file in which to save the key (/root/.ssh/id_rsa): [Press enter] (Recommend press enter)
4. Enter passphrase (empty for no passphrase): [Type password] (Recommend keep blank)
5. Enter same passphrase again: [Type password again] (Recommend keep blank)
6. For ubuntu
     Start the ssh-agent - $ eval "$(ssh-agent -s)"
   For windows
     1. $ ssh-agent bash
     2. $ eval "$(ssh-agent -s)" 
7. $ ssh-add ~/.ssh/id_rsa
8. Open  ssh-keygen.pub
9. Copy key from ssh-keygen.pub
10. Add into ssh-agent
11. Now, get data from your repository : git clone git@github.com:whatever