Protecting the php.ini File from Being Viewed

To prevent people 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, which can help php crackers from finding exploits on your site.
  • 3 Users Found This Useful
Was this answer helpful?

Related Articles

phpWebSite

Q: What is phpWebSite? A:  phpWebsite is a powerful CMS with a document manager,...

How do I view the php information page?

Create a page named phpinfo.php and insert the below code into it.  Pull this page up in...

Do you support mod_php?

Due to security precautions, we currently do not have, or have plans to have, a system with mod_php.

How can I execute php code as .htm or .html files?

In your .htaccess file insert this line of code: AddType application/x-httpd-php5 .php .html

How do I change my upload_max_filesize?

Locate the php.ini file in the folder your upload script resides in.  If none exists, create...