php5 not being run as www-data

喜夏-厌秋 提交于 2019-12-11 09:55:19

问题


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

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