Current time: 12-24-2024, 12:25 PM Hello There, Guest! (LoginRegister)


Post Reply 
PHP File Permission Denied
Author Message
Diego Offline
Junior Member
*

Posts: 30
Joined: Sep 2009
Reputation: 0
Post: #1
PHP File Permission Denied
I'm trying to access this address and I'm gettin permission denied:
http://www.abracadabra-designs.com/store/install.php

What could be wrong?
09-18-2009 12:44 PM
Find all posts by this user Quote this message in a reply
gOOvER Offline
Banned

Posts: 3,561
Joined: Jul 2007
Post: #2
RE: PHP File Permission Denied
How did you upload the files? I think, not via FTP. Wink
(This post was last modified: 09-18-2009 03:21 PM by gOOvER.)
09-18-2009 03:12 PM
Visit this user's website Find all posts by this user Quote this message in a reply
MasterTH Offline
Member
***

Posts: 570
Joined: Feb 2009
Reputation: 4
Post: #3
RE: PHP File Permission Denied
check if file permissions are right, owner & group should be like the other files.
i'm not sure what kind of chmod php-files need, but php-files has to be executable
09-18-2009 04:25 PM
Find all posts by this user Quote this message in a reply
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
gOOvER Offline
Banned

Posts: 3,561
Joined: Jul 2007
Post: #5
RE: PHP File Permission Denied
Nice Script. I will add it to the Wiki Smile
09-18-2009 05:21 PM
Visit this user's website Find all posts by this user Quote this message in a reply
joximu Offline
helper
*****
Moderators

Posts: 7,024
Joined: Jan 2007
Reputation: 92
Post: #6
RE: PHP File Permission Denied
I use it often, when copying files from one customer to another (or creating scripts with root...) or - most times - after transfer of www-data from an old server to the ispcp server.

I named it vu_setperm.sh - but I don't persist on that name :-)

/J
09-18-2009 05:47 PM
Visit this user's website Find all posts by this user Quote this message in a reply
kilburn Offline
Development Team
*****
Dev Team

Posts: 2,182
Joined: Feb 2007
Reputation: 34
Post: #7
RE: PHP File Permission Denied
joxi, just a comment. Why don't you use vuxxx:www-data and remove the world-readable flag to all files?
09-18-2009 05:57 PM
Visit this user's website Find all posts by this user Quote this message in a reply
joximu Offline
helper
*****
Moderators

Posts: 7,024
Joined: Jan 2007
Reputation: 92
Post: #8
RE: PHP File Permission Denied
because php (fastcgi) then complains about wrong group.

/J

upd: btw: if you upload images/html files via ftp you also have this owner/permission...
(This post was last modified: 09-18-2009 06:16 PM by joximu.)
09-18-2009 06:13 PM
Visit this user's website Find all posts by this user Quote this message in a reply
kilburn Offline
Development Team
*****
Dev Team

Posts: 2,182
Joined: Feb 2007
Reputation: 34
Post: #9
RE: PHP File Permission Denied
Quote:because php (fastcgi) then complains about wrong group.
You are already applying specific permissions for php files, so it's just a matter of changing the group just for them Wink

Quote:upd: btw: if you upload images/html files via ftp you also have this owner/permission...
... and here is where you got me Wink
(This post was last modified: 09-18-2009 06:28 PM by kilburn.)
09-18-2009 06:28 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Diego Offline
Junior Member
*

Posts: 30
Joined: Sep 2009
Reputation: 0
Post: #10
RE: PHP File Permission Denied
(09-18-2009 05:18 PM)joximu Wrote:  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

Thanks for that code, worked for the messages I got earlier..
Just one thing, I can't rename/delete/move files using ftp:
Code:
[21:28:42] 150 Opening ASCII mode data connection for file list
[21:28:42] 2032 bytes transferred. (5,80 KB/s) (342 ms)
[21:28:42] 226 Transfer complete
[21:28:57] DELE test.html
[21:28:58] 550 test.html: Permission denied

File owner is set to www-data and I'm login into with the user abracadabra@abracadabra-designs.com
What's wrong now? Sad
09-19-2009 10:31 AM
Find all posts by this user Quote this message in a reply
Post Reply 


Forum Jump:


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