Search code examples
phpcentosprestashop

How to fix permissions error with prestashop on centos 7 apache?


Installing Prestashop 1.7.6.2 An error has occured:

You need to grant write permissions for PHP on the following directory: /var/www/html/presta

This error appears while installing Prestashop. It's staying with 0%.

I have:

  • centos 7
  • PHP 7.3.14

Solution

  • change var/www/html/presta owner to www-data if you're using apache or to nginx if you're using nginx.

    chown -R www-data:www-data /var/www/html/presta

    But DO NOT change permissions to 777 since this wil open your site completely, change directories to 0755 and files to 0644 instead.

    Inside shop root folder:

    find . -type f -exec chmod 644 -- {} + to set proper permissions for all files

    find . -type d -exec chmod 755 -- {} + to set proper permissions for all directories

    chmod 666 .htaccess to set proper permissions for .htaccess