Welcome Guest, Not a member yet? Register   Sign In
Message: mkdir(): Permission denied
#14

I have to start the procedure from the begining. When the page loads for first time in my Post_model I have this script
PHP Code:
// set up the folder for storing images and thumbnails
$dir FCPATH 'uploads' DS 'posts';
if (!
is_dir($dir)) {
    
mkdir($dir0755true);
    
mkdir($dir DS 'thumbnails'0755true);

the posts folder and the thumbnails sub-folder are created but they belong in daemon user and daemon group (which I honestly don't know where they come from). By this I mean user and group of the os. So any images that I try as a member user of the site are uploaded having this user and group name, see:
Code:
/opt/lampp/htdocs/www/my-app/public/uploads/posts$ ls -lah

drwxr-xr-x 3 daemon    daemon    4,0K Sep  30 22:41 .
drwxrwxrwx 3 lykos     lykos     4,0K Sep  30 22:40 ..
-rw-r--r-- 1 daemon    daemon    738K Sep  30 22:41 post-img-11.png
-rw-r--r-- 1 daemon    daemon    738K Sep  30 22:41 post-img-12.png
-rw-r--r-- 1 daemon    daemon    738K Σεπ  30 22:41 post-img-1.png
drwxr-xr-x 2 daemon    daemon    4,0K Σεπ  30 22:40 thumbs

which pretty much doesn't allow me to delete them. If it do

Code:
sudo chown -R lykos /opt/lampp/htdocs/www/my-app/public/uploads
sudo chown -R :lykos /opt/lampp/htdocs/www/my-app/public/uploads

drwxr-xr-x 3 lykos lykos 4,0K Sep  30 22:41 .
drwxrwxrwx 3 lykos lykos 4,0K Sep  30 22:40 ..
-rw-r--r-- 1 lykos lykos 738K Sep  30 22:41 post-img-11.png
-rw-r--r-- 1 lykos lykos 738K Sep  30 22:41 post-img-12.png
-rw-r--r-- 1 lykos lykos 738K Sep  30 22:41 post-img-1.png
drwxr-xr-x 2 lykos lykos 4,0K Sep  30 22:40 thumbs

Then I can easily delete images and the folders if I want to. But if I try to upload another image the upload library shows me the error that the folder is not writeble and doesn't let me upload.

I really don't understand what's going on .. do I have to set the hole php script that creates the folders and uploads images to a user (lykos) or some group and change some permissions too ?? I 'm completely confused..
Reply


Messages In This Thread
Message: mkdir(): Permission denied - by Lykos22 - 09-29-2015, 03:13 PM
RE: Message: mkdir(): Permission denied - by Lykos22 - 09-30-2015, 03:31 PM



Theme © iAndrew 2016 - Forum software by © MyBB