问题
I have some files that I need php to service to a client. These files are owned by www-data
as they should be, with permissions 644
. Access to these files is beig denied however, so I ran this little script:
<?php
echo shell_exec('whoami');
?>
which prints out daemon
, thisis not the user that I want php running as.
Where in the php or apache configuration files can I set it so that php is run as user www-data
?
Edit: I've seen this link, but I do not want to set up aliases, and I believe that only applies to running php scripts form the terminal.
Edit 2: php v5.6 with apache v2.4 on ubuntu 12.04LTS
回答1:
The user and group Apache is running as is set in httpd.conf with the User and Group directives. Changing them to www-data
should get you what you need.
来源:https://stackoverflow.com/questions/26063556/php5-not-being-run-as-www-data