Most frequently you may need to change database settings after moving to new hosting.
Here is how you can do that:
Be careful with these settings. Incorrect config will break your site.
PrestaShop 1.7
- Using your FTP client or file manager navigate to your PrestaShop root and open this file: /app/config/parameters.php
- Find the lines with database_host, database_name, database_user and database_password parameters.
- Replace existing values of those params by the new ones.
- Save the file and upload it back to the server.
All done! Open your site in the browser and check whether it works.
IMPORTANT: sometimes you might need to manually clear the site cache to apply the settings. Delete all content of folder “/var/cache/” under the site root. You can do it by using your hosting file manager or by FTP. “/var/cache/” contains folders “dev”, “prod” and similar. Be careful not to delete something else.
Here is an example config:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | <?php return array ( 'parameters' => array ( 'database_host' => '127.0.0.1', 'database_port' => '', 'database_name' => 'your_database_name', 'database_user' => 'your_database_user', 'database_password' => 'your_database_password', 'database_prefix' => 'ps_', 'database_engine' => 'InnoDB', 'mailer_transport' => 'smtp', 'mailer_host' => '127.0.0.1', 'mailer_user' => NULL, 'mailer_password' => NULL, 'secret' => 'Vz6rVXVYNWYt7E6Fvfvdfvg34MCdc97h3IttReewVIxNOu7wHAoS', 'ps_caching' => 'CacheMemcache', 'ps_cache_enable' => false, 'ps_creation_date' => '2017-05-22', 'locale' => 'en-US', 'cookie_key' => 'xduROM3yvjDSym43CvfdvFDVD47YG8zCrVruNFjjZ3NUb7Ut9', 'cookie_iv' => '7kBvdfvgh', 'new_cookie_key' => 'def00000766ffa61aae49b279evfsdvsdfvsfdvfdvwerr324r3frdfveb1afedc8702a964f0a1f6828bf1623ca54efad10ed4bbfb289beec62b01a3062d4c3ce78254157', ), ); |
PrestaShop 1.5 – 1.6
- Using your FTP client or file manager open this file: /config/settings.inc.php
- Find the lines with _DB_SERVER_, _DB_NAME_, _DB_USER_ and _DB_PASSWD_ parameters.
- Replace existing values of that params with the new ones.
- Save the file and upload it back to the server.
All done! Open your site in the browser and check whether it works.
Here is an example config:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | <?php define('_DB_SERVER_', 'localhost'); define('_DB_NAME_', 'your_database_name'); define('_DB_USER_', 'your_database_user'); define('_DB_PASSWD_', 'your_database_password'); define('_DB_PREFIX_', 'ps_'); define('_MYSQL_ENGINE_', 'InnoDB'); define('_PS_CACHING_SYSTEM_', 'CacheApc'); define('_PS_CACHE_ENABLED_', '0'); define('_COOKIE_KEY_', 'VydXpBBvqfdVyGyVY44qVfFTvL23AG1szj0Avsd271PtuNw5CbORvvOIs'); define('_COOKIE_IV_', 'PIx53ASw'); define('_PS_CREATION_DATE_', '2017-05-07'); define('_PS_VERSION_', '1.6.1.14'); define('_RIJNDAEL_KEY_', '4H8PRpv43fsdDSuZXUx9iLiiwRb2af5'); define('_RIJNDAEL_IV_', '8Xav8t+xvdft54D+k/KI1g=='); define('_PS_DIRECTORY_', '/../../'); |
For 1.7, the “database_password” was encrypted. Once I changed it, how to encrypt it and update into the /app/config/parameters.php
Hello Respected brothers ,
Today I just initialized prestashop in my webhost,
but i encountered this Error;
1. SQL error on query Specified key was too long; max key length is 1000 bytes
How may I rectify this problem I really need your assistance at the utmost urgency, Thank You
Hi, I need help with Prestashop 1.7.4.3. I want to conct my database, but I did not find the parameters.php in this directoty: app/config.
Ah, I forgot to edit these 3 tables:
PRSTSHP_SHOP_DOMAIN
PRSTSHP_SHOP_DOMAIN_SSL
PRSTSHP_SHOP_URL
Hi polosat,
Thanks for the info for Prestashop 1.7 – but I have an issue. After cloning my site using Plesk from domain A to domain B and editing the DB connection file on domain B, connecting to domain B redirects me to domain A – I feel like more needs to be configured, any ideas where?
test with this file you will find the informations of connection
/app/cache/prod/appProdProjectContainer.php