Which file location is the best place to store PHP files for maximum security?

Avatar
  • updated
  • Answered

My index.html file is located in public_html/my_domain_name.  I also have a PHP file which has a link from index.html which allows users to send contact information.  I currently have the PHP file located in the same directory as index.html.

I don't want the public to be able to read the PHP file.

Should I leave the PHP file where it is or is there a better location in the directory structure?

What file protection should I put on the PHP file?  It is currently 644.

Pinned replies
Avatar
JT S.
  • Answer
  • Answered

Hello and thanks for contacting us. I recommend using the least privileges needed for the app to run properly. Depending on your goals, you may want to consider adding password protection. Consider having a solution that easily scans your website(s) for malware such as the ClamAV scanner for VPS Hosting customers. You can always v to request a security scan. For an enterprise-level security solution, check out Sucuri

Avatar
JT S.
  • Answer
  • Answered

Hello and thanks for contacting us. I recommend using the least privileges needed for the app to run properly. Depending on your goals, you may want to consider adding password protection. Consider having a solution that easily scans your website(s) for malware such as the ClamAV scanner for VPS Hosting customers. You can always v to request a security scan. For an enterprise-level security solution, check out Sucuri