Current time: 11-27-2024, 10:38 AM Hello There, Guest! (LoginRegister)


Post Reply 
PHP File Permission Denied
Author Message
joximu Offline
helper
*****
Moderators

Posts: 7,024
Joined: Jan 2007
Reputation: 92
Post: #4
RE: PHP File Permission Denied
no - php files do not need the execute flag.

you can write a script which sets the correct permissions and owners:
eg:
Code:
!/bin/bash

username=$(ls -ld . | cut -d" " -f3)
echo "Set to user/group: $username/$username"
echo "Cancel -> Ctrl-C, otherwise press Enter..."

read

# set owner vu:vu - folders
cmd="find ./ -type d -exec chown $username:$username {} ;"
#echo $cmd
($cmd)

# set owner vu:vu - files
cmd="find ./ -type f -exec chown $username:$username {} ;"
#echo $cmd
($cmd)

# set permissions - folders
cmd="find ./ -type d -exec chmod 0755 {} ;"
#echo $cmd
($cmd)

# set permissions - files
cmd="find ./ -type f -exec chmod 0644 {} ;"
#echo $cmd
($cmd)

# php files: less permissions (do not need to be world readable)
cmd="find ./ -type f -regex .*\.php$ -exec chmod 0640 {} ;"
#echo $cmd
($cmd)

echo "finished..."
echo ""

run the script inside the htdocs folder (but the htdocs folder must have correct ownership!!! - the script get's the owner of the currect folder!)

/J
09-18-2009 05:18 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply 


Messages In This Thread
PHP File Permission Denied - Diego - 09-18-2009, 12:44 PM
RE: PHP File Permission Denied - gOOvER - 09-18-2009, 03:12 PM
RE: PHP File Permission Denied - MasterTH - 09-18-2009, 04:25 PM
RE: PHP File Permission Denied - joximu - 09-18-2009 05:18 PM
RE: PHP File Permission Denied - theprincy - 09-19-2009, 02:55 PM
RE: PHP File Permission Denied - gOOvER - 09-18-2009, 05:21 PM
RE: PHP File Permission Denied - joximu - 09-18-2009, 05:47 PM
RE: PHP File Permission Denied - kilburn - 09-18-2009, 05:57 PM
RE: PHP File Permission Denied - joximu - 09-18-2009, 06:13 PM
RE: PHP File Permission Denied - kilburn - 09-18-2009, 06:28 PM
RE: PHP File Permission Denied - Diego - 09-19-2009, 10:31 AM
RE: PHP File Permission Denied - kilburn - 09-19-2009, 10:37 AM
RE: PHP File Permission Denied - Diego - 09-19-2009, 11:06 AM
RE: PHP File Permission Denied - Diego - 09-19-2009, 08:55 PM

Forum Jump:


User(s) browsing this thread: 6 Guest(s)