CodeIgniter Forums
Correct permissions for Writable folder? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: Correct permissions for Writable folder? (/showthread.php?tid=73000)



Correct permissions for Writable folder? - happyape - 03-08-2019

Could somebody show me what permissions do I need to setup for Writable and it's sub folders?

I am getting this error

CodeIgniter\Cache\Exceptions\CacheException

Cache unable to write to /var/www/myproject/writable/cache/

I am on Ubuntu 18.04 using CI4 beta 1.


RE: Correct permissions for Writable folder? - elephpantech - 03-08-2019

(03-08-2019, 10:35 AM)happyape Wrote: Could somebody show me what permissions do I need to setup for Writable and it's sub folders?

I am getting this error

CodeIgniter\Cache\Exceptions\CacheException

Cache unable to write to /var/www/myproject/writable/cache/

I am on Ubuntu 18.04 using CI4 beta 1.

writable folder and child folders must be owned by web server process, in my Linux Centos is apache (production)
    chown -R apache /var/www/myproject/writable

Or allowing total control to everyone (development)
    chmod 777 -R /var/www/myproject/writable


RE: Correct permissions for Writable folder? - arwystli - 03-08-2019

(03-08-2019, 12:26 PM)elephpantech Wrote:
(03-08-2019, 10:35 AM)happyape Wrote: Could somebody show me what permissions do I need to setup for Writable and it's sub folders?

I am getting this error

CodeIgniter\Cache\Exceptions\CacheException

Cache unable to write to /var/www/myproject/writable/cache/

I am on Ubuntu 18.04 using CI4 beta 1.

writable folder and child folders must be owned by web server process, in my Linux Centos is apache (production)
    chown -R apache /var/www/myproject/writable

Or allowing total control to everyone (development)
    chmod 777 -R /var/www/myproject/writable

As you are on Ubuntu, if you have root access you can set
 chown -R www-data:www-data var/www/myproject/writable


RE: Correct permissions for Writable folder? - InsiteFX - 03-09-2019

Or 775 776


RE: Correct permissions for Writable folder? - happyape - 03-11-2019

(03-09-2019, 02:35 PM)InsiteFX Wrote: Or 775 776

Thanks


RE: Correct permissions for Writable folder? - krlwbstr - 04-24-2020

If your dir permissions are correctly set, worth taking a look at this as it could be to do with permissions of the httpd in SELinux.

This worked for me (Centos7):

A simple check to validate:
1) Create test.php in app root
<?php file_put_contents("/var/www/html/<codeigniterpath>/writable/test.txt", "test");

2) Execute it from command line. It should create the file with test inside.
Then delete test.txt.

3) Call from browser https://url/test.php

If it doesn't create, check /var/log/audit.log, look for "denied { write } " relating to the httpd/apache.
If you find these entries, then it might be to do with permissions for httpd in SELinux.

Try:
chcon -Rv --type=httpd_sys_rw_content_t /var/www/html/<codeigniterpath>/writable/

or google "SELinux apache write permissions" for clues


RE: Correct permissions for Writable folder? - InsiteFX - 04-24-2020

File permissions table:

The mode parameter consists of four numbers:

1) The first number is always zero
2) The second number specifies permissions for the owner
3) The third number specifies permissions for the owner's user group
4) The fourth number specifies permissions for everybody else
Possible values (to set multiple permissions, add up the following numbers):

1 = execute permissions
2 = write permissions
4 = read permissions