[英]Apache2 + fcgid download script when query string ends with “.php”
我正在將apache2 + php服務器遷移到mod_fcgid,並且當我嘗試訪問以“ .php”結尾的鏈接時,服務器將輸出php源代碼。
GET: http://host/?inc=test.php
Does download of the index.php script
但是,當我修復index.php時。
GET: http://host/index.php?inc=test.php
Show the correct page content
在我的網站配置中:
Options Indexes FollowSymLinks MultiViews +ExecCGI
AllowOverride AuthConfig FileInfo Limit
AddHandler fcgid-script .php
FcgidWrapper /var/www/cgi-bin/fcgi-starter .php
其中fcgi-starter是用於包裝/ etc / php5 / cgi的自定義sh
#!/bin/sh
PHPRC=/etc/php5/cgi/
export PHPRC
export PHP_FCGI_MAX_REQUESTS=5000
export PHP_FCGI_CHILDREN=8
exec /usr/lib/cgi-bin/php
如何更改配置以忽略查詢字符串?
問候
我認為問題對ServerFault更好。 但我覺得
?inc=test.php
並不是很好的解決方案。 希望您能防止遠程包含攻擊您的網站並從服務器讀取文件。
現在,您的include文件每次都是一個php文件,然后從URL中刪除.php並將其添加到腳本中。
但是,當您在腳本中定義它時,它會更好,那么您就不會有任何問題。
$incFile = false;
switch($_GET['inc']):
case 'test':
$incFile = 'test.php';
break;
default:
$incFile = 'nofile.php';
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.