2

my Hosting is use Apache and PHP

i understand what it's mean 777 in CHMOD or drwxrwxrwx or Owner, Group, Public => read, write, execute.

  1. i understand with the RW CHMOD command but what about the X, it for authorization execute the Shell command or my PHP script or both?
  2. When we upload the image through browser, let's says in CMS (wordress, joomla, etc) whe have ability to upload image. when we do it, what is the CHMOD we need? since i assume if access via web browser then we are as public

sorry for my bad english, i don't know how to explain it's more simple.

2
  • @GusDe CooL - normally we dun need the executable write especially in web environment, in CLI php -q FILE will do, same as shell, of course for hardy purpose, we often change it to executable (my 2cents, dun scold me)
    – ajreal
    Nov 18, 2010 at 5:47
  • it's preferred to refer to permissions as User, Group, Other (ugo) as it's how you can set permissions with chmod (eg. chmod u+x file). Since you talk about "web hosting", it's possible that the hosting service already set up the right permission for you so you don't have to worry about it.
    – Danosaure
    Nov 18, 2010 at 6:14

2 Answers 2

3

Your PHP scripts will be executed whether the "X" permission bits are set on the PHP files or not. That's because the script itself is not a standalone executable -- it's just an input file to the PHP interpreter, so "R" permission is sufficient.

For a shell script that starts with a "shebang" line (for example, #!/bin/bash), the "X" permissions will be checked before the OS allows the script to be executed.

For directories, the "X" permission bits are interpreted differently -- rather than granting "execute" permission, they grant "search" permission -- is that user allowed to list the contents of that directory?

1
  • The "X" is not checked before the script is executed. The OS does not recognize it as a command if it does not have 'X'. You can always run the script by explicitly calling the interpreter (eg bash my_script). The 'X' on directory does not grant 'search', it grants access. To list a directory, you need 'R' permission.
    – Danosaure
    Nov 18, 2010 at 6:10
0

usually what I have is

chmod 770 the_folder

and

chown apache_user:apache_group the_folder

and make sure that ftp_user added to apache_group so that you could modify the files usign this command

usermod -G apache_group ftp_user

hope helps! :)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .