> For the complete documentation index, see [llms.txt](https://sumeru.gitbook.io/sumeru-cyber-security/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sumeru.gitbook.io/sumeru-cyber-security/common-vulnerabilites/php.ini-file-available-publicly.md).

# Php.ini File Available Publicly

## Introduction

PHP's 'ini' file is exposed inside the 'cgi-bin' directory. This allows any unauthenticated remote user to discover sensitive information about your server(s), including database logins and passwords.

## How to Test

By default the php.ini file is stored in the public\_html folder on your server. When you visit your domain and add /php.ini at the end of it like the following:

`http://your-domaincom/php.ini`

You will see the contents of your PHP configuration available over the internet.

## How to Fix

To secure your php.ini settings so they are not publicly viewable, you can restrict access to the php.ini and other file types with the following code in your .htaccess.

```
<filesMatch ".(htaccess|htpasswd|ini|phps|fla|psd|log|sh)$">   
Order Allow,Deny   
Deny from all  
</filesMatch> 
```

You can add more file types to the restriction by separating each file type in the code with a | and adding the file extension without the ( . )

## Reference

[https://www.inmotionhosting.com/support/website/restrict-public-access-php-ini/  ](<https://www.inmotionhosting.com/support/website/restrict-public-access-php-ini/  >)
