dealing with files in php
I am creating a file with php. I just want to be able to create it, with no content, under开发者_Go百科 a directory. Then I want to be able to edit it when I access my server with ftp. I can't! The user of php is different from the ftp user, and this last one does not have permissions to change it! I tried chmod,umask,chown, but nothing works. Anybody knows how to do it? Thanks
Cheers
In PHP, after you move or otherwise create the file, just change it's permissions using chmod()
:
chmod($file, 0666);
Don't give execute permissions (which 0777 would) otherwise someone on the system can execute it. Huge security vulnerability.
give your file world writeable permissions chmod('filename', 0666)
精彩评论