How install PHP & APACHE and to solve this directory permission 755

May 8, 2008

My Problem – When we upload file in upload dir at that time directory permission set – 777 but this is not fare.

Any one accesses this directory.

Instead of we upload file in upload dir at that time directory permission set – 755 then no one access this directory.

(Directory permission – 777 not good for system)

How install PHP & APACHE and to solve this directory permission 755 set and Run As The User Instead of “nobody”

We need install mod_suphp to set file permission 644 and directory permission 755

For example, we have 2 users with their home directories:

/home/smith/www

/home/lora/www

And user ‘smith’ has a file ‘/home/smith/www/my_secure_data.txt’ that he manages by his php software.

Since all php software under mod_php is run from common user ‘nobody’, this user ‘nobody’ should have read or/and write permissions for this file. But in this case user ‘rob’ can run a PHP file manager, go to directory /home/smith/www/ and read/change ‘my_secure_data.txt’ file.

Unfortanly, many web hosting companies have this secure problem.

To avoid this problem apache provides ‘suexec’ technology to run users’ software under their own system accounts.

It means user ‘smith’ has ‘my_secure_data.txt’ chowned to ‘smith’ and

it will work because his applications are run under ‘smith’ system account at suexec enviroment.

Basically, suexec technology is provided for applications running as cgi scripts.

We’ll show how to enable php to run php scripts as cgi.

Better understanding to read this article.

http://www.phpasks.com/suphp/index.html