Page 1 of 1

Permission new files

PostPosted: 18. October 2016 23:16
by krychu_m
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

Re: Permission new files

PostPosted: 19. October 2016 11:13
by Nobbie
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.