CODE CODIFY.CLUB

Set permissions for all files and folders recursively PHP LINUX COMMAND

PrestaShop : While installation PS every time this F*****g  Folder and Files permission issue happens to me.

In general cache folder needs 777 permission and rest are 755 for folders and 644 for files. Following is PHP script which will do that. It solved many permission related issues.

Following PHP script will update all folder permission to 755 and all files with 644 permission.

<?php
exec (“find /path/to/folder -type d -exec chmod 0755 {} +”);
exec (“find /path/to/folder -type f -exec chmod 0644 {} +”);
?>


What are File Permissions?

There are three types of permissions:

  •     Read
  •     Write
  •     Execute

You can view your file permissions in your cPanel File Manager or FTP Client.  They will display not with the letters, but with numbers.  The numbers used are:

    7 = read, write, execute
    6 = read, write
    5 = read, execute
    4 = read only
    3 = write, execute
    2 = write only
    1 = execute only
    0 = Access Denied

The File Permissions will show as three numbers. The numbers always go in the same order:

  •     User
  •     Group
  •     World

V!ral

Developer, Technology aficionado, Beer Lover and founder of codify.club Network. Who shares a keen interest about website development, health issues, cancer awareness and other fun stuff.

Add comment

Follow us

Don't be shy, get in touch. We love meeting interesting people and making new friends.

Most popular

Most discussed