2014-10-19 59 views
1

我的名字lebnik信息,以及关于我:为什么我的php脚本只在文件权限读写时执行?

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

我的Web服务器Apache的从用户WWW的数据运行PHP的脚本,看看这个:

[email protected] /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脚本file.php:

<?php 
error_reporting(E_ALL); 
ini_set('display_errors',1); 

echo 'script executed'; 
?> 

接下来,我检查的权限我file.php

# ls -la 
total 16 
drwxrwxrwx 1 www-data www-data 4096 Oct 18 00:49 . 
drwxrwxr-x 1 www-data www-data 4096 Oct 18 00:36 .. 
-rw-rw-r-- 1 www-data www-data 225 Oct 18 00:46 file.php 

我尽量把我的脚本与Apache:卷曲http://starsite.l/file.php看到:

script executed 

为什么我的PHP脚本时,文件权限只读执行和写?

回答

3

执行权限阻止shell执行文件,但它不会阻止其他应用程序读取文本文件并执行它。 php引擎不关心可执行权限位。

相关问题