Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/241.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
nginx php fpm无法打开流拒绝权限_Php_Nginx_Server_Debian - Fatal编程技术网

nginx php fpm无法打开流拒绝权限

nginx php fpm无法打开流拒绝权限,php,nginx,server,debian,Php,Nginx,Server,Debian,我的NGINIX上有一个php文件(带有php fpm),可以创建一个简单的txt文件 <?php $content = "some text here 123 myText.txt"; $fp = fopen($_SERVER['DOCUMENT_ROOT'] . "/myText.txt","wb"); fwrite($fp,$content); fclose($fp); ?> 但这只有在我授予“www”文件夹777权限时才有效。My Index.php位于我的www文件夹

我的NGINIX上有一个php文件(带有php fpm),可以创建一个简单的txt文件

<?php
$content = "some text here 123 myText.txt";
$fp = fopen($_SERVER['DOCUMENT_ROOT'] . "/myText.txt","wb");
fwrite($fp,$content);
fclose($fp);
?>

但这只有在我授予“www”文件夹777权限时才有效。My Index.php位于我的www文件夹中


我在nginix和php fpm上的用户设置有什么问题?

当我将我的www文件夹的所有权授予我的nginx用户(定义见
/etc/nginx/nginx.conf
)后,它就工作了

chown -R www-data:www-data www

php-fpm
nginx
在哪个用户下运行?你是个救生员。。。这解决了我的问题