Presta_lover Posted November 26, 2019 Share Posted November 26, 2019 (edited) Hi guys, I write the steps I followed for clonating my online shop with prestashop 1.7.6 to my local machine (localhost). What did I use? - OS linux mint - terminal shell command line and phpmyadmin - SSH Download prestashop files from the live server You can do this from FTP to any folder in your machine I did it in /Downloads/clon-presta-new-folder/ (If you try to do it in /var/www/html you could have some permission problems...) Export database with default settings Best way is from phpmyadmin: export but if you need via SSH you can do it as follow: mysqldump -u dbusername -p dbname > /path/to/file/nameOfFileYouLike.sql Create localhost database with the same name Import database copy from your machine, open the terminal and import it as: mysql -u dbusername -p dbname < /path/to/file/file.sql Copy downloaded files into new location copy from /Downloads/clon-presta-new-folder/ to /var/www/html/prestashopFolderName Change database_host, database_user and database_password in: app/config/parameters.php You can open first your file from live shop to remember some data if you need In ps_configuration table from phpmyadmin: Change PS_SHOP_DOMAIN to localhost Change PS_SHOP_DOMAIN_SSL to localhost Change PS_SSL_ENABLED to 0 In ps_shop_url: Change domain to localhost Change domain_ssl to localhost Change physical_uri to the PS location (mine is /prestashop/) don't forget slash! Delete .htaccess from the root folder better just rename it as: _,htaccess Disable and enable once again Friendly URLs in admin settings Enter to your backoffice (BO) with your URL + adminMANYNUMBERSANDLETTERS (i.e mine: dntlgfmql6vhltxy) After you enter, as I say, you have to change to NO and after that save. Do it again to YES and save. This is very importat tyo do it. Hope none have problems. Happy coding Edited January 13, 2020 by Calleja (see edit history) 4 2 Link to comment Share on other sites More sharing options...
Art et Tonneaux Posted December 10, 2020 Share Posted December 10, 2020 (edited) Hi, Thank you for this, working well for me except for friendly urls. I've disabled, saved, enabled, saved again, and it's not working. If I try to disable friendly url, everything is working (with ugly urls ) Any idea of what can be the problem ? [EDIT] mod_rewrite was not enabled on apache2. Everything is ok now... Edited December 13, 2020 by Art et Tonneaux (see edit history) Link to comment Share on other sites More sharing options...
darkin Posted March 5, 2021 Share Posted March 5, 2021 Thanks for instructions... Something similar was doing on old version and it worked, but now have some issues ... Presta 1.7.6.5 sitting on localhost... Can find ps_configuration table but no PS_SHOP_DOMAIN; PS_SHOP_DOMAIN_SSL etc. Preparing to move to live host from local and am a bit confused? Maybe any suggestions? Thanks in advance Link to comment Share on other sites More sharing options...
ecommX Posted March 7, 2021 Share Posted March 7, 2021 (edited) This is what worked for me: Create a new local DB and name it differently from your online DB, Import the full DB dump into it, Copy all your files to your localhost site root, Rename .htaccess to _.htaccess (or simply delete it) in the root of your localhost site, Go to var/ and delete the Caches folder, Using phpMyAdmin change PS_SHOP_DOMAIN and PS_SHOP_DOMAIN_SSL to localhost (or localhost:XXXX) where XXXX would be your default or custom port, Change PS_SSL_ENABLED to 0 Edit app/config/parameters.php to reflect your local server settings Worked for me using MAMP locally. I didn't have to disable/enable anything in BO. Just clear all Caches. Edited March 7, 2021 by ecommX (see edit history) Link to comment Share on other sites More sharing options...
darkin Posted March 7, 2021 Share Posted March 7, 2021 Thanks. Managed to change location for shop on localhost. Found settings in table ps_shop_url... At the moment everything seems like working. Link to comment Share on other sites More sharing options...
coelhoo Posted March 11, 2021 Share Posted March 11, 2021 Thanks a lot! That was 100% painless! Link to comment Share on other sites More sharing options...
Eutanasio Posted April 25, 2022 Share Posted April 25, 2022 (edited) Thanks! crystal clear! I¡ve got to access the admin in local, but when I try to access the Front it sends me to the original website instead. Is something related to having the website in 2 languages, which in this case the website needs to decide where to redirect you and then it sends me to the published website instead of the route in localhost, because when I use the localhost mentioning the /en/ in the url, it keeps me in local Edited April 25, 2022 by omar2886 I think is something related with languages (see edit history) Link to comment Share on other sites More sharing options...
Gunnar Posted September 25, 2022 Share Posted September 25, 2022 Thanks a lot. But I needed to use my ip address instead of localhost to get it working. Probably due to that my localhost isn't configured correctly:-\ Link to comment Share on other sites More sharing options...
WisQQ Posted September 26, 2022 Share Posted September 26, 2022 Turn off and on friendly urls i backoffice. It will rewrite htaccess and let you access localhost front. Link to comment Share on other sites More sharing options...
JoaquimMarques Posted September 28, 2022 Share Posted September 28, 2022 Thanks! Perfect! It worked on the first attempt. Link to comment Share on other sites More sharing options...
MAPH25 Posted June 29, 2023 Share Posted June 29, 2023 Hi All, I have done exactly what Presta_lover recommends and really close what ecommX recommend (My difference is that the new DB is called as the one working on the live website). After all these steps are done, when I try to access to back office login, the ERR_CONNECTION _REFUSED is there. My server is a PC set up with ubuntu server 22.04.2, Apache, MariaDB and PHP 7.3 for my Prestashop 1.7.7.2. This equipment is connected to the same router than the computers from I try to acces on the local network. Also, I have myphpadmin installed and correctly running with full access to the new database, and can connect to it from wevery computer in the local network. I can´t find where is the problem. I thought it could be W11 but when I try to access from a laptop with Linux the situation is the same. Firewall is running on the server but http, httpd and all necessary ports are open and as I mentioned I can access without problem to phpmyadmin and Apache is serving virtual hosts, no Apache error logs.. Debug mod is active and I´m not received error messages when I try to access to back office login. I can see the route to the admin´s folder when I try to access but the result is err_connection_refused I will follow checking, testing and trying different things... all comments will be really welcome.. Thanks in advance! Link to comment Share on other sites More sharing options...
Gunnar Posted June 29, 2023 Share Posted June 29, 2023 Hi MAPH25. It was a long time since I did this but I remember that I also had the same ERR_CONNECTION _REFUSED but I can't remember in which state it happened. For some reason that I can't remember I got it working in the end. I just opened my notes to see what I might have done. One note is to use the ip-address instead of localhost in ps_shop_url. Here are the most important parts of my notes. I wish you good luck! 7. In ps_configuration table from phpmyadmin: Change PS_SHOP_DOMAIN to localhost (use ip instead) Change PS_SHOP_DOMAIN_SSL to localhost (use ip instead) Change PS_SSL_ENABLED to 0 8. In ps_shop_url: Change domain to localhost (use ip instead) Change domain_ssl to localhost (use ip instead) Change physical_uri to the PS location (mine is /prestashop/) don't forget slash! 9. Delete .htaccess from the root folder better just rename it as: _,htaccess 1 Link to comment Share on other sites More sharing options...
MAPH25 Posted June 29, 2023 Share Posted June 29, 2023 Thank you very much Gunnar.. honestly this is a madness.. I´ve tried using server´s IP but I will try it again. I have just created a new database named different than the original (working on live) as ecommX adviced to dischart all possibilities. I will try with IP also and let you know. Thanks! Miguel Link to comment Share on other sites More sharing options...
MAPH25 Posted June 29, 2023 Share Posted June 29, 2023 2 hours ago, Gunnar said: Hi MAPH25. It was a long time since I did this but I remember that I also had the same ERR_CONNECTION _REFUSED but I can't remember in which state it happened. For some reason that I can't remember I got it working in the end. I just opened my notes to see what I might have done. One note is to use the ip-address instead of localhost in ps_shop_url. Here are the most important parts of my notes. I wish you good luck! 7. In ps_configuration table from phpmyadmin: Change PS_SHOP_DOMAIN to localhost (use ip instead) Change PS_SHOP_DOMAIN_SSL to localhost (use ip instead) Change PS_SSL_ENABLED to 0 8. In ps_shop_url: Change domain to localhost (use ip instead) Change domain_ssl to localhost (use ip instead) Change physical_uri to the PS location (mine is /prestashop/) don't forget slash! 9. Delete .htaccess from the root folder better just rename it as: _,htaccess Hi again, When I set my IP instead 'localhost' i obtain the next: [PrestaShopException] Link to database cannot be established: SQLSTATE[HY000] [2002] Connection refused at line 136 in file classes/db/DbPDO.php 131. public function connect() 132. { 133. try { 134. $this->link = $this->getPDO($this->server, $this->user, $this->password, $this->database, 5); 135. } catch (PDOException $e) { 136. throw new PrestaShopException('Link to database cannot be established: ' . $e->getMessage()); 137. } 138. 139. $this->link->exec('SET SESSION sql_mode = \'\''); 140. 141. return $this->link; DbPDOCore->connect - [line 330 - classes/db/Db.php] DbCore->__construct - [line 241 - classes/db/Db.php] - [4 Arguments] DbCore::getInstance - [line 47 - config/alias.php] pSQL - [line 1336 - classes/shop/Shop.php] - [1 Arguments] ShopCore::findShopByHost - [line 337 - classes/shop/Shop.php] - [1 Arguments] ShopCore::initialize - [line 118 - config/config.inc.php] require - [line 40 - admin/index.php] - [1 Arguments] When I set it to 'localhost' this exception dissapears. Puting special attention to phpMyAdmin: to access, I input 'http://192.168.1.39/phpmyadmin' on EGDE explorer and I get the login access window. After I log in, in the label of the explorer´s tab I can read '192.168.1.39/localhost | phpMyAdmin 5.2.1' . In the explorer´s address bar is displayed '192.168.1.39/phpmyadmin/index.php?route=/&route=%2F' So I understand that 'localhost' is the correct one on my situation... but still having the ERR_CONNECTION_REFUSED problem... Spin, spin, spin.... the black circle.. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now