user2260265
user2260265

Reputation:

How to get permission for file access

Code:

$file= '../LOGS/'.$time.'.csv';
chmod("../LOGS/", 777);
$fp = fopen($file, 'c+');

I get warning: "operation not permitted".

How to get permission. Please Help me.

Upvotes: 1

Views: 118

Answers (1)

Burhan Khalid
Burhan Khalid

Reputation: 174624

This means that the user that is executing the script (most likely www-data or httpd or whatever is the user for the web server process) does not have access to change the permissions on a file.

To obtain this access, you would need to talk to the system administrator in order to configure the server properly to allow access to the files that are saved by your scripts.

Finally - 777 is always the wrong permission mask for your files. You are basically creating a lovely security open door with fresh flowers, a welcome mat and milk and cookies if you set such liberal permissions on files on a web accessible server.

Upvotes: 2

Related Questions