How to assign the correct permissions to my PrestaShop files and folders?

The problem

"I have changed my hosting and my Back Office does not let me authenticate", "I can not upload images to my products", "the images of my products do not load correctly in the Front Office", "the update module does not work in 1 -Clic "... These and many others are the first indications that we have an incorrect assignment of the permissions to the files and folders of our online store with PrestaShop. This problem especially appears when we have made a change in the environment where we had running our store, say a migration from local server to productive or simply a change of hosting.

The cause

In order for a web server to resolve the requests made from our clients' web browsers, it needs to read and execute certain files or files, mainly those with the .php extension. The person in charge of executing the content of these files is a process (commonly the Apache web server) that runs in an operating system (often Linux for standard hosting servers) under a user with certain permissions. When the permissions to our files or folders do not allow that process to read and execute them correctly, errors appear on our site that may be HTTP 500 or similar.

The solution

The problem may seem complex but the solution is really simple. With the exception of a few hosting our files need permissions 0644 (reading) and our folders 0755 (reading and execution). The assignment of these permissions must be recursive, that is, that covers all the folders and subfolders of the site.

There are several ways to undertake the allocation of permits recursively. Here's how to do it:

  • Assignment of permissions from an FTP client: we can assign the necessary permissions using any FTP connection client. The task is long because the client will go through each file and folder of our site assigning the indicated permissions. If we are not in a hurry this is the first option. After establishing the connection, we locate the main folder, right click on it, click on "File Permissions" and a configuration window will appear where we must indicate the permissions and apply them recursively.

    Asignacion recursiva de permisos a ficheros con cliente FTP Filezilla

    Asignacion recursiva de permisos a carpetas con cliente FTP Filezilla

  • Assignment of permissions through an SSH connection: this is the fastest way to assign permissions since it allows executing a command directly in the server console which is executed in a few seconds. The bad news is that not all servers have this type of connection active. Commonly only available on VPS and dedicated servers.

    Asignacion recursiva de permisos a ficheros y carpetas desde consola SSH

    Once connected to the server console and positioned in the main route of the store (commonly "public_html") we must execute the commands:

    find . -type f -exec chmod 0644 {} +

    find . -type d -exec chmod 0755 {} +

  • Assignment of permits through cPanel or similar: this is the option that most of us will have access to more easily. The bad thing is that from cPanel we can not assign the permissions recursively, therefore we will have to go one by one for each file (or group of files). Otherwise we will have to ask for technical support from our hosting to see if they can help us.

    Asignacion de permisos a ficheros desde cPanel

    To not complicate life so much, there is a little trick that should normally work and is to assign the permissions only to a small priority group of files and folders. This way we could solve specific problems of operation of our site. Although it might work, this is not the recommended solution. To make the change of permissions we must only select the files and click on the "Permissions" option.

    To eliminate problems with the upload of images or authentication in the Back Office this would be the list of folders and files that should be checked first:


    To eliminate problems with the display of the Front Office or the Ajax requests associated with the shopping cart:


    To eliminate problems with viewing images in the Front Office:


    To eliminate problems with the execution of Ajax calls from a particular module:


IMPORTANT: Always remember, permissions 0644 for files and 0755 for folders.

NOTE: there are some folders that additionally need write permissions such as the one of images of our site.

Share this post