Permissions for PHP scripts - Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more
Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more
Go Back   Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more > Webmaster Tech > Programming > PHP Development

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 04-10-2010, 03:49 PM   #1 (permalink)
Junior Member
 
Join Date: Apr 2010
Posts: 2
Default Permissions for PHP scripts

I'm confused about setting permissions for the PHP scripts on my website (linux/apache). Is it possible for someone to read a file from my site if the permissions are set to 644? For example, I have a php script (set to php) that will decrypt some info using a key. The key is stored in a .inc file in the same directory as my html pages and php scripts - all are set to 644.

I don't want someone to be able to read my script or the include file. Will the 644 be enough? If not, what program could they use to get those files? What can I chmod them to so that they can be run by anybody but not read by anybody except me (the owner)?

Surprisingly, I've had real trouble finding an answer to this - most people don't seem concerned about READING the php script, just changing it.

Thanks,
Tom
ghotion is offline   Reply With Quote
Sponsored Links
Old 04-10-2010, 07:13 PM   #2 (permalink)
Regular User
 
Join Date: Aug 2009
Posts: 280
Default Re: Permissions for PHP scripts

The folder which is critical in PHP script is installation folder so remove it after installing script.
itbuzz is offline   Reply With Quote
Old 04-11-2010, 08:01 AM   #3 (permalink)
Junior Member
 
Join Date: Apr 2010
Posts: 2
Default Re: Permissions for PHP scripts

Thanks for the response, but I do not have an installation package. Maybe I'm using the wrong terminology.

I wrote a php program that serves up a web page. I copied the php program to my web site, with permissions 644 (it also includes another file on my web site "xxx.inc" which also has permissions 644. Can someone copy or see my php program or the include file? What is the most restrictive permissions I can give a php file that serves up a web page to the world?

Thanks for any advice you can give.
ghotion is offline   Reply With Quote
Old 06-25-2010, 07:06 AM   #4 (permalink)
Junior Member
 
Join Date: Jun 2010
Posts: 20
Default Re: Permissions for PHP scripts

Hello, I have written some scripts that generate simple webpages. I would like to prevent web vistors from viewing the source of these scripts , but it is fine for them to run them. What permissons should I set (Linux). I currently have the folder they are contained in set to 711 and the scripts within the file as 744. Is this correct? Thanks!
alstonwillman is offline   Reply With Quote
Old 06-26-2010, 12:52 AM   #5 (permalink)
Junior Member
 
Join Date: Jan 2010
Location: desklancer.com
Posts: 68
Send a message via Skype™ to gullsinn
Default Re: Permissions for PHP scripts

Best practice is that
name your files and folders different then normal for example
folder name probably is images where we store images name this folder some thing else and also make sure that directory browsing is disabled by PHP.INI

secondly put a small code that confirms if your website is being visited by a script if so just return a 404 error


the one who do not want to show source code you may need to use Classes in PHP as much as possible and design with CSS use css as much as possible
gullsinn is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Sponsors

» Links

» Affiliates
Web Hosting
Online Backup Reviews
Marketing Find
Merchant Select
SiteMap Builder
Host Compare

» Links

» Sports Network
Paintball Forum
Football Forum
Hockey Forum
Golf Forum
Boxing Forum
Lacrosse Forum
Baseball Forum
SnowBoarding Forum
Soccer Forum
MMA Forum


All times are GMT -4. The time now is 07:40 PM.


Powered by vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.2
Webmaster Forums
Web Hosting | Chicago Web Hosting | Web Hosting