File and directory permissions, chmod
File permissions should be 644, directory permissions 755.![20151008_FQDlvYLk](https://screenpast.com/20151008_FQDlvYLk.png)
![20151008_vVHbfx3m](https://screenpast.com/20151008_vVHbfx3m.png)
If PHP is run by a specific user (using FastCGI or PHP-FPM), as recommended for security reasons, the recommended permissions for PHP files are 600. This is sufficient for both read and write access. To give read-only permissions, you should set it to 400.
![20151008_1TE2gnRC](https://screenpast.com/20151008_1TE2gnRC.png)
![20151008_rrll2Mln](https://screenpast.com/20151008_rrll2Mln.png)
In this case, 711 is sufficient for the directory with PHP files. These permissions are also sufficient for writing to the directory, since the operation is performed by the user.
![20151008_DnDQrggW](https://screenpast.com/20151008_DnDQrggW.png)
In the case of PHP running as an apache module, the permissions on PHP should be 644, as well as on all other files. And writing to a file requires 666 and to a directory 777.
28 Apr 2024, 18:51:05