How to Protect Your php.ini File
To prevent people from viewing your php.ini file via a browser, a few lines need to be pasted into the .htaccess file. This change prevents PHP hackers from finding exploits on your site. Learn how to protect your php.ini file in a few steps and protect your site from hackers.
How to Hide Your php.ini File
Follow these steps to protect your php.ini file:
- Log in to your Bluehost Account Manager.
- Once logged in, click the Hosting tab on the left side of your Account Manager.
- If you have multiple Hosting packages on your account, click the MANAGE button on the Hosting package you want to manage.
- If you only have a single Hosting package on your account, you will be taken to the Hosting Overview page.
- Click on the FILE MANAGER button under the Quick Links section.
- Go to your public_html folder.
- Look for your .htaccess file. Right-click on the file and select Edit.
- Paste the following code into the bottom of the file and then click save:
<Files php.ini> Order allow,deny Deny from all </Files>
Now, your php.ini file is protected.
Summary
Secure your php.ini file by adding specific lines of code to your .htaccess file. This will prevent any php-related breaches on your site. Go to your File Manager and add a code to deny public access to your php.ini file. Following these steps will help protect your hosting environment from hackers.
If you need further assistance, feel free to contact us via Chat or Phone:
- Chat Support - While on our website, you should see a CHAT bubble in the bottom right-hand corner of the page. Click anywhere on the bubble to begin a chat session.
- Phone Support -
- US: 888-401-4678
- International: +1 801-765-9400
You may also refer to our Knowledge Base articles to help answer common questions and guide you through various setup, configuration, and troubleshooting steps.