Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP mkdir() permissions

Tags:

php

mkdir

apache

I have a Linux server with appache as the web server. In my PHP script I am making directories with 0777 mode. the code is pretty simple as follows:

mkdir($path,0777)

when I run this script and go to my server file manager, the folder is there but the permission assigned to that folder is 0755. I can't figure out why this is happening!! when the folder is created the user column has apache in it but the permission is 0755.

like image 979
samach Avatar asked Oct 24 '11 16:10

samach


People also ask

How do I fix mkdir permission denied?

[ErrorException] mkdir(): Permission denied. That means you do not have write permission on your project folder. Create a new folder, say 'myproject and run sudo chmod 777 myproject . Then move to 'myproject' folder and create project.

What is mkdir option?

The mkdir command creates one or more directory elements. (Operating system directory creation commands create view-private directories, not elements.) Unless you specify the –nco (no checkout) option, the new directory is checked out automatically.

How create directory if not exists in PHP?

Methods: file_exists(): It is an inbuilt function that is used to check whether a file or directory exists or not. is_dir(): It is also used to check whether a file or directory exists or not. mkdir() : This function creates a directory.


1 Answers

You can try:

chmod ( string $filename , int $mode )

See if that can fix the permissions issue.

like image 183
Kurt Funai Avatar answered Oct 11 '22 01:10

Kurt Funai