Jump to content

[SOLVED]Moving Prestashop from local server to live server (DETAILED INSTRUCTIONS)


Recommended Posts

Hi Guys,

 

Can someone help with moving Prestashop from localhost to live server. I almost finished adopting Presta 1.5 to my needs, everything was done on localhost using XAMPP. Now I need to move it to live server and I'm stacked. Tried moving manually and using Installatron but I failed on both :/

 

can someone who already accomplished moving presta to live server can provide detailed step by step instructions?

 

i found this before but do not find very useful (lack of details)

 

Presta Shop - Local Development (XAMPP) to live server

 

 

Part 1 - Database

1) Create username and database in live server

 

2) Export database on XAMPP’s phpMyAdmin in .sql format

 

3) Do a find & replace old database name to new database name (there should be 1 instance only)

 

4) Login to the live server’s phpMyAdmin, import in the updated database

 

 

Part 2 – Content

1) Edit config/settings.inc.php with your live server’s database details. Line 3, 5, 6, 7, 9.

 

2) Upload all file via ftp to live server

 

 

3) Website should be live

Edited by mag80 (see edit history)
  • Like 1
Link to comment
Share on other sites

If you need step-by-step details, it would be helpful to know who your hosting with and if you have a control panel (like cPanel) that you are able to access. I'll try and explain the items you listed in a little more detail, and perhaps that will help you get it handled:

 

Part 1 - Database

1) Create username and database in live server

- Log into your hosting control panel, and find the MySQL section. You'll need to create a new database. Once you have a new database created, you'll need to add a database user to it. Make note of the database name, the user name, and the password.

 

2) Export database on XAMPP’s phpMyAdmin in .sql format

 

From XAMPP, you need to log into phpMyAdmin - you can usual do this by going to http://localhost/ and clicking on phpMyAdmin.

From there, find your prestaShop database, and on the top click the "Export" tab. Follow the instructions on that page and export the database.

 

3) Do a find & replace old database name to new database name (there should be 1 instance only)

(no idea what this is talking about)

 

4) Login to the live server’s phpMyAdmin, import in the updated database

 

 

 

Now find phpMyAdmin in your site's control panel. Log into your database with the information you took note of. Once in here, you may need to click the name of your database on the left panel. Then click the "Import" tab in the right panel. Browse to the .sql file you exported above, and submit the page. It should import your tables into the database.

 

 

Part 2 – Content

1) Edit config/settings.inc.php with your live server’s database details. Line 3, 5, 6, 7, 9.

 

This file is in your prestashop folder in you xampp install. Find it and edit it to include the new server information you created above. Edit the lines mentioned to match your new hosting provider.

 

2) Upload all file via ftp to live server

 

Use an FTP application like FileZilla (pc) or CyberDuck (mac) to upload the files to your new hosting provider. Be sure you put them in the correct folder!

 

3) Website should be live

 

Test your site and it should be live. If not, we'll need some more information on what went wrong or errors that you're getting.

 

I hope this helps!

 

-Andy

Link to comment
Share on other sites

chipslay, your post should be removed by admin, as it's not related to the main topic I'm afraid.

 

a2hosting andy, thanks for your help!

 

your post is actually bringing some light on the topic. I followed your instructions and in the meantime I found more details in another thread on this forum - this one is really detailed:

 

 

1. After getting your hosting, use an FTP program (eg dreamweaver or other) to upload the contents of your prestashop folder into the root directory. On the localhost, my files were kept in a folder inside htdocs directory. Perhaps you have a different configuration.

 

2. Export the SQL database using phpmyadmin from the localhost. You can find phpmyadmin from the MAMP or WAMP welcome screen. You would have used this to create your prestashop database when you installed it.
The settings I used were:
In phpmyadmin
Under Export, use select all, and click on SQL

Add DROP TABLE / VIEW / PROCEDURE / FUNCTION / EVENT
Add IF NOT EXISTS
Add AUTO_INCREMENT value
Enclose table and field names with backquotes
check these options under the structure.

In the field provided, type a filename for your export, click on gzipped option in and click GO at bottom right of screen.
It should land in the downloads folder. Go and locate this file.

 

3. On your webhosting control panel, go and find the section where they allow you to create a SQL database.
On my hosting it was “Add SQL database” – part of the cPanel.

Create the new database and select all privileges.
Ensure you select a good database name, with a strong password. You wont be needing to access this often so it doesnt have to be memorable.
VERY IMPORTANT: Make sure you write all the settings down! Preferably COPY/PASTE into a dedicated document.
Then, choose the phpmyadmin part from the cPanel.
Choose the database you just created, and click on the import tab.
Locate the file you just exported (above) from your local hard drive.
make sure “utf8” is selected.
format should be SQL, click “GO”

 

4. On your webserver, navigate to config/settings.inc.php file and edit the settings to line up with the new database details.

 

 

define('__PS_BASE_URI__', '/<your folder name on the web server>/');

define('_THEME_NAME_', '<the mame of your theme>');

define('_DB_NAME_', '<the name of your database>');

define('_DB_SERVER_', 'localhost');

define('_DB_USER_', '<the name of the user you specified when creating your web based SQL database>');

define('_DB_PREFIX_', 'ps_');

define('_DB_PASSWD_', '<the password of the user you specified when creating your web based SQL database>');

define('_DB_TYPE_', 'MySQL');

define('_COOKIE_KEY_', '<the same cookie key that was in the local host version of this file>');

define('_COOKIE_IV_', '<the same cookie key that was in the local host version of this file>');

define('_PS_VERSION_', '1.3.6.0');

 

The things to change are in between < >.

 

 

5. You then need to change the .htaccess file in the root folder that was generated on your localhost.
The best way is to copy the contents of the file.
Then go to your backend (on the web) – you should be able to login my now.
Under tools, generators. Generate a new .htaccess.
Edit the new(web) one and compare it with the localhost version. Add any additions that the localhost version had. Some modules require you to paste some code into it.

You should have your shop up and running after this.

Please let me know if I have made any errors / anything to contribute.
Note, I have little experience with these things so probably unable to help answer questions, but post them here anyway and hopefully one of the contributors will be able to help out.

 

6. Finally, my database localhost when imported to my server database contained configuration settings that redirected the front-end to localhost.
I fixed this by using phpmyadmin on my server, finding my prestashop database, navigating to the ps_configuration table, found the following:

155 PS_SHOP_DOMAIN localhost 
156 PS_SHOP_DOMAIN_SSL localhost

and changed to:
155 PS_SHOP_DOMAIN http://www.mydomain.com
156 PS_SHOP_DOMAIN_SSL http://www.mydomain.com

 

(link to this thread is below:

http://www.prestasho...stashop-online/ )

Edited by mag80 (see edit history)
Link to comment
Share on other sites

[uPDATE] .htaccess file is automatically generated in presta 1.5.2 when you go to back office and turn on/off friendly url. but can't open backoffice at all. all files uploaded via filezilla to public_html folder in my server (I did not create separate folder for the shop), sql database seems to be correct as well. the only problem is the correct settings.inc.php file :/

Link to comment
Share on other sites

In the latest version of PrestaShop, the config lines you mentioned as missing are indeed gone - they have been removed from the config so you don't need to worry about them.

 

You mentioned the back office isn't working... so your front store is working properly? What happens when you try and go into the back office - what error do you receive?

Link to comment
Share on other sites

nothing is working I'm afraid, neither front nor back office. when I type my domain name in browser I'm getting

 

HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request.

Link to comment
Share on other sites

Hm. Well now we need to dig a little deeper. Are you able to get into the logs for your hosting company? We need to see precisely which errors are being thrown by your web server. If you can't find/access your logs, you can try adding a .htaccess file to your hosting directory with this line in it:

 

php_flag display_errors on

 

and then try and access your site. It will likely give you some more detailed information on the error at that point.

Link to comment
Share on other sites

sebkos, I changed that and now I can finally see login page on the live server but can't log on.

 

for some reason presta on live server is still linking to local host - when I type www.mydomainname.pl in browser and have my xampp on, presta on localhost is opened. when the xampp is off , i'm getting error.

 

my setting.inc file looks like this (I only covered password with xxxx) :

 

 

<?php

define('_DB_SERVER_', 'localhost');

define('_DB_NAME_', 'maciej_presta4');

define('_DB_USER_', 'maciej_presta4');

define('_DB_PASSWD_', 'xxxxxxxx');

define('_DB_PREFIX_', 'ps_');

define('_MYSQL_ENGINE_', 'InnoDB');

define('_PS_CACHING_SYSTEM_', 'CacheMemcache');

define('_PS_CACHE_ENABLED_', '0');

define('_MEDIA_SERVER_1_', '');

define('_MEDIA_SERVER_2_', '');

define('_MEDIA_SERVER_3_', '');

define('_COOKIE_KEY_', '1GSredIRqGwrwat3805GMHsqC2sWJa44xFRLPTsK3fEWvAezCIidWhte');

define('_COOKIE_IV_', 'ssWPxJo2');

define('_PS_CREATION_DATE_', '2012-10-26');

define('_PS_VERSION_', '1.5.2.0');

define('_RIJNDAEL_KEY_', 'd1xQM5Fnbd1HH4nv9AQJibhkYfoFwtOd');

define('_RIJNDAEL_IV_', 'PIjhRzQogx952lcANWpEbw==');

Edited by mag80 (see edit history)
Link to comment
Share on other sites

the error i'm getting is

 

Fatal error: Uncaught Link to database cannot be established: SQLSTATE[HY000] [2013] Lost connection to MySQL server at 'reading initial communication packet', system error: 111 thrown in

...public_html/classes/db/DbPDO.php on line 58

Link to comment
Share on other sites

senkos , thanks for your help :)

 

ps_shop_url was also showing "localhost" so I changed that to my domain name. in "phisical url " i put " / " as all my presta files are in main public-html folder. still no progress and the same error is occurring.

Link to comment
Share on other sites

yes, this is the copy of my own settings.inc file . I contacted my host provider yesterday and they must have changed something on their side , as today the site is working perfectly and I haven't done anything since yesterday. Just another reason to move my hosting to more reliable company.

 

ANDY and SEBKOS, thanks a lot for your help! With your help I managed to move presta to live server and above is probably the most detailed manual for this operation. I'm sure a lot of people will find it very useful too! thanks again, you guys are great!

Link to comment
Share on other sites

FOR ALL YOU PEOPLE WHO ARE TRYING TO MOVE YOUR PRESTA 1.5.2 FROM LOCALHOST TO LIVE SERVER, I'LL SHORTEN THIS THREAD AND PUT EVERYTHING TOGETHER. BELOW YOU CAN FIND STEP BY STEP MANUAL :

 

1. After getting your hosting, use an FTP program (eg dreamweaver or other) to upload the contents of your prestashop folder into the root directory. On the localhost, my files were kept in a folder inside htdocs directory. Perhaps you have a different configuration.

 

2. Export the SQL database using phpmyadmin from the localhost. You can find phpmyadmin from the MAMP or WAMP welcome screen. You would have used this to create your prestashop database when you installed it.
The settings I used were:
In phpmyadmin
Under Export, use select all, and click on SQL

Add DROP TABLE / VIEW / PROCEDURE / FUNCTION / EVENT
Add IF NOT EXISTS
Add AUTO_INCREMENT value
Enclose table and field names with backquotes
check these options under the structure.

In the field provided, type a filename for your export, click on gzipped option in and click GO at bottom right of screen.
It should land in the downloads folder. Go and locate this file.

 

3. On your webhosting control panel, go and find the section where they allow you to create a SQL database.
On my hosting it was “Add SQL database” – part of the cPanel.

Create the new database and select all privileges.
Ensure you select a good database name, with a strong password. You wont be needing to access this often so it doesnt have to be memorable.
VERY IMPORTANT: Make sure you write all the settings down! Preferably COPY/PASTE into a dedicated document.
Then, choose the phpmyadmin part from the cPanel.
Choose the database you just created, and click on the import tab.
Locate the file you just exported (above) from your local hard drive.
make sure “utf8” is selected.
format should be SQL, click “GO

 

4. On your webserver, navigate to config/settings.inc.php file and edit the settings to line up with the new database details. XXXXX are places where you need to type your DB name, user and password. Also in some cases you'll need to change DB server name [ ('_DB_SERVER_', 'localhost'); ] - you need to ask your host provider for the name - for me I had to leave it as localhost.

 

<?php

define('_DB_SERVER_', 'localhost');

define('_DB_NAME_', 'xxxxxxxxx');

define('_DB_USER_', 'xxxxxxxx');

define('_DB_PASSWD_', 'xxxxxxxx');

define('_DB_PREFIX_', 'ps_');

define('_MYSQL_ENGINE_', 'InnoDB');

define('_PS_CACHING_SYSTEM_', 'CacheMemcache');

define('_PS_CACHE_ENABLED_', '0');

define('_MEDIA_SERVER_1_', '');

define('_MEDIA_SERVER_2_', '');

define('_MEDIA_SERVER_3_', '');

define('_COOKIE_KEY_', '1GSredIRqGwrwat3805GMHsqC2sWJa44xFRLPTsK3fEWvAezCIidWhte');

define('_COOKIE_IV_', 'ssWPxJo2');

define('_PS_CREATION_DATE_', '2012-10-26');

define('_PS_VERSION_', '1.5.2.0');

define('_RIJNDAEL_KEY_', 'd1xQM5Fnbd1HH4nv9AQJibhkYfoFwtOd');

define('_RIJNDAEL_IV_', 'PIjhRzQogx952lcANWpEbw==');

 

 

 

 

5. Now you have to change your database, as it is still linking to your localhost. Go to phpmyadmin on your server, navigate to ps_configuration table and you'll find this:

 

155 PS_SHOP_DOMAIN localhost 
156 PS_SHOP_DOMAIN_SSL localhost

 

change that to :
155 PS_SHOP_DOMAIN http://www.mydomain.com
156 PS_SHOP_DOMAIN_SSL http://www.mydomain.com

 

Now navigate to ps_shop_url in the same database and also change "localhost" to http://www.mydomain.com .If your Presta files are root directory in public HTML folder in "Actual URL" field type " / "

 

 

It should all work fine now! If there are any questions, post a reply and I'll try to help :)

Link to comment
Share on other sites

lisam, .htaccess file is created automatically ones you you switch "friendy URL" on and off in preferences. What I did was:

 

1. delete .htaccess file on the server ( if there is any)

2. log into BO on your localhost - go to "Friendly URL" menu, change the location of your web from localhost to your actual web server.

3. switch Friendly URL on (.htaccess file is created now)

4. copy this file to your server

 

before you copy file to server you can open it and check if you have correct details there. hope that helps.

Link to comment
Share on other sites

  • 3 months later...

mag80

 

I have tried step by step accordingly to the instructions but the error 500 keeps coming back to haunt me. I have seen so many guides and have repeated the steps over again and they were all the same as your guide; i just wanted to be sure, but again to no avail, the error 500 keeps getting thrown back at me.

 

I dont understand what is going on. The only thing i had different was that on my localhost my PS files resided in a sub directory. e.g. localhost/exampleshop. does this affect how i import or edit my database?

 

Thanks for any answers.

 

Edited:

 

Wow, i finally got it working. turning display_errors on really helps. Turns out initally i was pointing to a wrong database name, after changing that, i had an error "Uncaught exception 'SmartyException' with message 'unable to write file". Changed my files permissions and presto, all are done. Your post is a life saver. i hope this helps someone else too.

 

cheers all

Edited by thegnomes (see edit history)
Link to comment
Share on other sites

  • 2 weeks later...

Hi,

 

I've been trying to create a development environment before upgrading my store and making some theme changes.

 

Are there any 'best practices' for moving there and back between test and production... it has been quite a headache getting a test environment up and running although I did it in the end!

 

Warren

Edited by warrenm (see edit history)
Link to comment
Share on other sites

×
×
  • Create New...