Permission new files

Problems with the Linux version of XAMPP, questions, comments, and anything related.

Permission new files

Postby krychu_m » 18. October 2016 23:16

Hi All

I have a problem. By default, the page will use this construction
Code: Select all
file_put_contents('example.txt', 'abc')

Will be set right 644, but it needs the 664. How can I change this in lampp server?

Thanks for any help.

Krzysztof
User avatar
krychu_m
 
Posts: 1
Joined: 18. October 2016 22:59
Location: Poland
XAMPP version: LAMPP 5.6.23-0
Operating System: Linux Ubuntu 16.04

Re: Permission new files

Postby Nobbie » 19. October 2016 11:13

You cannot change that in the software (i.e. in Apache Server or PHP), that is a configuration option of Linux. See the Linux manual about "umask".

You also may try to change the file mode via chmod() in your PHP script after calling file_put_contents, but it depends on the default rights of the User which runs Apache (and creates the files) if chmod() is successfull. If it fails, you have to modify the umask value for that User.
Nobbie
 
Posts: 8772
Joined: 09. March 2008 13:04


Return to XAMPP for Linux

Who is online

Users browsing this forum: No registered users and 5 guests