Welcome Guest, Not a member yet? Register   Sign In
Problem using created directories using mkdir

I am working on uploading photos and love the CI libraries to help, but I am having a little problem I hope someone can help.

I create a folder for each user so in my script I check to see if that folder exists and if not use mkdir to create it. mkdir creates the directory with the owner of 'apache', with permissions of 777.

[[email protected] photos]# ls -la user/1
total 8
drwxrwxrwx 2 apache apache 4096 Sep 7 09:58 .
drwxrwxrwx 3 opti4 apache 4096 Sep 7 09:58 ..

CI returns FALSE from function is_really_writable() when I try to upload the photo. It is because the owner is 'apache' and not 'opti4' who is the user of this virtual host. I am not sure why the 777 permission is not enough. If I change the owner to 'opti4' then it works fine. Problem is CI will not allow me to run chown when I create the directory so I cannot change the owner.

How can I create a directory on the fly and use it with CI?

This is what apache 1 does.

Either move or update the hosting so it is running apache2. This will then create folders with the www_data permission.

Or if you have access to ssh write a bash script to call after each new folder is created to set the correct owner & permissions.

Hope this gets you on the right track.

[[email protected] 1]# httpd -v
Server version: Apache/2.2.3
Server built: Jan 15 2008 20:33:30

Theme © iAndrew 2016 - Forum software by © MyBB