2013-03-01 2 views

답변

4

시도하여 .htaccess :

<FilesMatch "php.ini"> 
    Order allow,deny 
    Deny from all 
</FilesMatch> 

그것은 사람에 대한 액세스를 거부 php.ini에 도달하려고합니다.

편집 : 허용 및 주문은 Apache 2.4에서 사용되지 않습니다. 대신 Require all denied을 사용해야합니다.

<FilesMatch "php.ini"> 
    Require all denied 
</FilesMatch> 
+0

대단히 고마워! – Brett

1

한 가지 방법은 php.ini의 파일의 시작 부분에 이런 식으로 뭔가를 삽입 할 일은 :이 넣어

/***************DO NOT ALLOW DIRECT ACCESS************************************/ 
if ((strpos(strtolower($_SERVER[ 'SCRIPT_NAME' ]), strtolower(basename(__FILE__)))) !== FALSE) { // TRUE if the script's file name is found in the URL 
    header('HTTP/1.0 403 Forbidden'); 
    die('<h2>Forbidden! Access to this page is forbidden.</h2>'); 
} 
/*****************************************************************************/ 
+1

'php.ini'에서 PHP 코드를 실행할 수 있습니까? –

관련 문제