Reinstalling PrestaShop is a process that involves removing the existing installation and setting it up again. This guide walks you through the steps to ensure a clean and successful reinstallation.

Backup Existing Data (Optional but Recommended)

Before reinstalling PrestaShop, it is a good idea to back up your current store, just in case you need the data later.

Backup the Files

  1. Log in to your server via SSH or FTP.
  2. Navigate to the directory where PrestaShop is installed (e.g., /var/www/html/prestashop).
  3. Download the directory to your local computer.

Backup the Database

  1. Log in to phpMyAdmin or connect via MySQL CLI:
  2. mysqldump -u root -p prestashop_db > prestashop_backup.sql
  3. Save the database backup to a secure location.

Remove the Existing Installation

1

Delete Files

  1. Navigate to the PrestaShop directory:
  2. cd /var/www/html/prestashop
  3. Delete the entire directory:
  4. sudo rm -rf /var/www/html/prestashop
2

Drop the Existing Database

  1. Log in to MySQL:
  2. sudo mysql -u root -p
  3. Drop the PrestaShop database:
  4. DROP DATABASE prestashop;
  5. (Optional) Recreate the database for a fresh install:
  6. CREATE DATABASE prestashop;
    CREATE USER 'prestashop_user'@'localhost' IDENTIFIED BY 'password';
    GRANT ALL PRIVILEGES ON prestashop.* TO 'prestashop_user'@'localhost';
    FLUSH PRIVILEGES;

Download and Reinstall PrestaShop

Download PrestaShop

  1. Navigate to your web server root directory:
    cd /var/www/html
  2. Download the latest version of PrestaShop:
    wget https://download.prestashop.com/releases/prestashop_1.7.8.8.zip

Extract Files

  1. Install unzip if not already installed:
    sudo apt install unzip -y
  2. Extract the archive:
    unzip prestashop_1.7.8.8.zip
    mv prestashop /var/www/html/prestashop

Set Permissions

  1. Set ownership:
    sudo chown -R www-data:www-data /var/www/html/prestashop
  2. Set proper permissions:
    sudo chmod -R 755 /var/www/html/prestashop

Create a New Configuration

  1. Open your browser and navigate to:
    http://yourdomain.com
  2. Follow the installation wizard:
    • Database Details: Enter the database name, username, and password you created earlier.
    • Admin Account: Set up a new administrator account.

Post-Installation Steps

Delete the Install Directory

After completing the installation, delete the install directory for security:

sudo rm -rf /var/www/html/prestashop/install

Secure Your Admin Directory

  1. Rename the admin directory:
  2. mv /var/www/html/prestashop/admin /var/www/html/prestashop/admin_secure
  3. Update the new directory name in your browser:
  4. http://yourdomain.com/admin_secure

Optional: Restore Data

If you need to restore data from your previous installation:

  1. Import the backed-up database:
    mysql -u root -p prestashop < prestashop_backup.sql
  2. Copy old images, themes, or other files back to /var/www/html/prestashop.

Troubleshooting

Issue Solution
Installation wizard not loading Check file permissions and web server configuration.
Database connection error Verify database credentials and user privileges.
Blank page after reinstallation Enable PHP error reporting and check logs.

Reinstalling PrestaShop ensures a clean setup, resolving any previous configuration issues.