Protecting the php.ini file from being viewed

To prevent people to viewing your php.ini file via a browser a few lines need to be pasted into the .htaccess file.

1) Login to the cPanel
2) Click on File Manager
3) Open the public_html folder (click on the folder icon next to public_html)
4) Click on .htaccess and then select the "Edit File" option on the right hand of the window.
5) 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 and which can help php crackers from finding exploits on your site.

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

FastCGI for PHP

FastCGI for PHP FastCGI for PHP makes all your PHP applications run through mod_fcgid instead...

Configuring the PHP Environment With php.ini

The servers use a master php.ini file for all directories without a php.ini file in it. You will...

Upload_Max_Filesize

In a nutshell: Locate the php.ini file in the folder your upload script resides in. If none...

How do I enable PHP 5 for my PHP applications?

1. Login to your Control Panel and click the PHP Config icon. 2. Select PHP5 (Single php.ini)....

Tricks for getting around phpsuexec

When a php script requires write access to a file or directory (like Nucleus does for the...