[PHP2.05] What are the correct file permissions for a PHP file?

As a general rule, the permissions of a PHP file should take one of two sets of values, either 644 or 600.

644 - A PHP file needs to be world readable if it is to be called via your web browser (meaning it is being processed by Apache). Do not include important passwords or secret keys in world-accessible files, as this opens your site up for those with malicious intent.

600 - For include files, typically containing unique keys or passwords (e.g. MySQL credentials, PayPal API Keys). If a PHP file is not accessed directly via your web browser (only referenced via other PHP files), use these permissions.

Was this answer helpful?

 Print this Article

Also Read

[PHP2.02] What is the path to perl?

/usr/bin/perlYou can also find information on paths to other useful programs by logging in to...

[PHP2.09] Does Hosting cPanel support Image::Magick?

Does Hosting cPanel support Image::Magick?

[PHP2.04] How do I query a MySQL database from a PHP script?

Use the following outline to connect and begin querying the MySQL server from within your PHP...

[PHP2.12] Can PHP5/PHP4 code be put in files with the .html/htm file extension?

It is possible to run php code in .html files by adding the following to a .htaccess...

[PHP.15] How do I install Locked Area Lite?

Before you install Locked Area Lite you need to create a folder that you want to protect - this...