[英]Why my php-script executed when file permissions only read and write?
我的名字是lebnik,以及關於我的信息:
# 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-data運行php腳本,請檢查:
root@debian /etc/apache2 # grep -R "APACHE_RUN_USER=" .
./envvars:export APACHE_RUN_USER=www-data
有關用戶www-data的信息:
# id www-data
uid=33(www-data) gid=33(www-data) groups=33(www-data)
我創建php-script 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調用我的腳本:curl http://starsite.l/file.php並查看:
script executed
為什么我的php腳本只在文件權限讀寫時執行?
執行權限阻止shell執行該文件,但它不會阻止另一個應用程序讀取文本文件並執行它。 php引擎不關心可執行權限位。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.