Migrations Points for Prestashop VPS Hosting provider to Cloud hosting

Ravinayag
3 min readNov 28, 2020

Recently I got engaged with one of the clients who want to migrate their Prestashop domains to a new cloud server. The task was quite simple but ended up prolonging the completion by almost spent half a day. Though i googled to get technical articles, troubleshooting articles, discussions where i doing mistakes, none have been pointing my problem. (of course)

I will be covering quick points for the migration task and explaining a little more on the solution side.

Prestashop 1.6.1.17— using PHP 7.1

Preparation for Migration :

1, Login to Prestashop admin panel and apply maintenance by enabling in the Preference menu.

So your customers may know under maintenance, and you can avoid data missings

2, Cleare the cache from the Admin menu or go to CLI under the path

~homedir/prestashop/cache/smartly/compile/* remove all files and folders except index.php

3, Now take the full backup, files/folders & database.

Files & Folders

tar cfz ps.tar.gz ~homedir/prestashop/*

Database

$ mysqldump -u root -p ps_database > ps_database_bkp.sql

4, Transfer the above two files to your new server using Filezilla / SCP / any other methods that you aware of.

5, Login to your new server, Create a database, database username, and provide access to user and database.

MySQL > create database ps_database
MySQL > CREATE USER ‘psdb_admin’@’localhost’ IDENTIFIED BY ‘Password’;
MySQL > GRANT ALL PRIVILEGES ON ps_database.* TO 'psdb_admin'@'localhost';

Note :/config/setting.inc.php’ you have to modify database name, database user, database password if you differentiate from the previous install(from backup) else you can ignore

6, Untar the files in public dir /var/www/ or some location ensure you update the apache config if you choose a different directory.

Ensure the file permissions are intact, if not do apply this

find . -type d -exec chmod 775 {} \;
find . -type f -exec chmod 644 {} \;

That’s All, NOW you can access Prestashop from the browser.

Note: You need to disable the maintenance from the admin panel for your customer access.

Appendix: Post Migration fixes

Here are my learnings since internet blog articles not covered.

Note: In Prestashop, the term used to call as back-office where others were called as admin panel

A1: After the 6th Step.

You may not able to access the admin menu or not able to login as admin from the admin URL.

PS : Admin URL can be identified from the folder structure under Prestashop install path. The directory name called ‘‘adminxxxx’’ where ‘‘xxxx’’ will be some random numbers.

This issue also called as, Admin URL problem, Admin login kicked out, Backoff login problem. This problem is universal and applies to version 1.4.x to 1.7.x

This is because you may not redirect your domain to a new server IP address at this time or you accessing from an IP address, Since the TLD are hardcoded in the database. (In my case I was using redirection for the test)

Spend many hours identifying this and it's held me for the validation Since i want to do before redirecting the domain name to a new IP address. I was using hosts.cx for redirection and validation and get blocked/filtered for two reasons.

a, Classes/cookie.php

Disable in the file “classes/cookie.php” inside the function “isLoggedBack()!Configuration::get('PS_COOKIE_CHECKIP'))

b, SHOP_URL & SHOP_DOMAIN*

Both data fields are relevant and co-related (i need to investigate and test this, running out of time)

Table name : SHOP_URL
PS_DOMAIN = example.com
PS_DOMAIN_SSL = example.com
Table name : CONFIGURATION
PS_SHOP_DOMAIN = example.com
PS_SHOP_DOMAIN_SSL = example.com

I can avoid this by using the subdomain theory, but there some logical reasons not to touch the DNS. One way i was happy, I may not learn this if I used the subdomain theory. Hopefully, it may help some readers who face similar problems.

A2 : After migration, None of the hyperlinks working.

This issue also called as, When we click, page not found error 404.

Once you were able to login to the admin panel, Go to preferences and choose SEO and URLs page. follow the instructions as per the screen and regenerate the .htaccess file.

touch ~homedir/prestashop/.htacces
chmod 666 ~homedir/prestashop/.htacces

A3 : You can disable the maintenance mode from the database by changing the value to 1,

Zero stands for enabling maintenance, and 1 stands for disabling maintenance.

SHOP_ENABLE = 1

Please comment / thumbs up if it helped you.

--

--

Ravinayag

Blockchain enthusiast & Research | DevOps Explorer | Hyperledger Explorer