Php脚本不是从用户www数据创建文件


Php-script create file not from user www-data

我的名字lebnik,以及关于我的信息:

# id lebnik
uid=1000(lebnik) gid=1000(lebnik) groups=1000(lebnik),24(cdrom),25(floppy),29(audio),30(dip),44(video),46(plugdev)

我的apache从用户www数据运行php脚本,请检查以下内容:

root@debian /etc/apache2 # grep -R "APACHE_RUN_USER=" .
./envvars:export APACHE_RUN_USER=www-data

关于用户www数据的信息:

# id www-data
uid=33(www-data) gid=33(www-data) groups=33(www-data)

我创建php脚本文件.php:

<?php
error_reporting(E_ALL);
ini_set('display_errors',1);
echo `whoami`;
$file = __FILE__.'.tmp';
file_put_contents($file, 'Hi');
echo file_get_contents($file)."'n";
$dirname = dirname(__FILE__);
echo `ls -la $dirname`;
?>

接下来,我尝试用Apache调用我的脚本:

# curl http://starsite.l/test/file.php
www-data
Hi
total 16
drwxrwxrwx 1 lebnik www-data 4096 Oct 18 00:49 .
drwxrwxr-x 1 lebnik www-data 4096 Oct 18 00:36 ..
-rw-rw-r-- 1 lebnik www-data  225 Oct 18 00:46 file.php
-rw-r--r-- 1 lebnik www-data    2 Oct 18 00:49 file.php.tmp

你看到了吗?PHP从用户lebnik创建文件file.PHP.tmp。我的配置有什么问题?

对不起,我从错误的用户安装了VirtualBox中的文件夹:

mount -t vboxsf -o uid=1000,gid=33 starsite.l /var/www/starsite.l

正确安装:

mount -t vboxsf -o uid=33,gid=33 starsite.l /var/www/starsite.l