質問

I have not used phing before, but would like to use it to automate my deployment process. Currently I log in under myuser, Apache runs under www-data. All my application code is owned by myuser, but other (cache) files are generated by www-data.

I currently solve this by using sudo to remove these files. I would like to keep the application code owned by myuser, because it's easier to access the files via ssh. I wouldn't like phing to run with super powers, because at this moment I don't trust this automated tool yet.

What is the best practice to use phing with limited file permissions?

役に立ちましたか?

解決

I had the same issue. Apache is running as www-data.www.data and files created by the webserver are 644 and directories 755.

I solved it by:

  1. adding the user running phing to the www-data group
  2. adding umask 002 to the /etc/apache2/envvar file, see link

Phing is now able to remove the directories and files created by the apache

他のヒント

As I understand it the problem is that phing can't do anything with the cache files since they were created by your Apache user (www-data) and you are running phing as myuser. It sounds to me like you just need to change the permissions on the cache files so that myuser has full permissions. How to do this will depend on how your application is written, but something along the lines of chmod/chowning'ing the files after creation or creating them with a umask allowing myuser permissions.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top