How to control the file permissions when the netbeans php plugin uploads a file with FTP

做~自己de王妃 提交于 2020-01-14 09:04:38

问题


Whenever netbeans preforms an ftp upload the files are uploaded with the permissions set to 640. This causes PHP to throw the following error:

Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0

Fatal error: Unknown: Failed opening required '/Library/WebServer/Documents/notes/index.php' (include_path='.:/usr/local/php5/lib/php') in Unknown on line 0

While I can clean it up with a quick chmod o+r ./* in the command prompt it causes netbeans to resynchronize the entire project next time I hit run which in turn sets the permissions back to 640.

I need a way to make netbeans upload the files with permissions set to 644.


回答1:


Make sure the checkbox for "Preserve Remote File Permissions" under Project Properties > Run Configuration is checked, if you want to not change remote file permissions.




回答2:


I determined that the problem was not with netbeans. It was with ftpd on the server.

The fix was to create a file called ftpd.conf in /etc/ and add the following line:

umask all 022



回答3:


In your vsftp.conf file, look for this:

# Default umask for local users is 077. You may wish to change this to 022,
local_umask=022

Then, un-comment / adjust as needed.




回答4:


Just to make a little easier if you are tired like I was. All the other answer where a rabbit hole and didn't work for me.



来源:https://stackoverflow.com/questions/711918/how-to-control-the-file-permissions-when-the-netbeans-php-plugin-uploads-a-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!