Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Block access to php.ini file

We have a custom php.ini and .htaccess file in the root of the web tree.

The .htaccess cannot be accessed by default but the php.ini can be accessed.

For example:

http://example.com/php.ini

Whats the recommenced procedure to block access to the php.ini file?

like image 219
zaf Avatar asked Dec 28 '25 15:12

zaf


1 Answers

Also if you must have it in the public folder try:

<Files php.ini>
  order allow,deny
  deny from all
</Files>
like image 72
Matt Avatar answered Dec 31 '25 07:12

Matt