Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

migrated from stackoverflow.com Nov 22 '10 at 14:01

This question came from our site for professional and enthusiast programmers.

    
@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 '10 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 '10 at 6:14

2 Answers 2

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?

share|improve this answer
    
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 '10 at 6:10

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! :)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.