5

I'm sure there's a well-known answer for this, but I can't seem to find it.

How do I make a user's PHP scripts (in ~user/public_html, for example), run as the owner rather than as (eg) www-data?

Assume Apache, Linux, and PHP 5.

womble
  • 95,029
  • 29
  • 173
  • 228
jes5199
  • 367
  • 1
  • 4
  • 8

1 Answers1

3

One option is to use suPHP.

http://www.suphp.org/DocumentationView.html?file=apache/INSTALL

The suPHP Apache module together with suPHP itself provides an easy way to run PHP scripts with different users on the same server.

It provides security, because the PHP scripts are not run with the rights of the webserver's user.

Zoredache
  • 128,755
  • 40
  • 271
  • 413
  • are there any other options? – Kshitiz Sep 05 '14 at 11:08
  • if you aren't limiting yourself to apache/mod_php then I think so. I am pretty sure there is something you can do with fastcgi. – Zoredache Sep 05 '14 at 15:29
  • I tried FastCGI and php-fpm but I can't run them same as how suPHP does. I have a lot of files in my folder which are owned by different users. suPHP allows me to run each file as the owner but fastCGI doesn't do that.. for FastCGI I can only set up static usernames and then it runs with them – Kshitiz Sep 05 '14 at 15:47
  • I really didn't dig into this much myself. You may need to post a new question describing your unique requirements. – Zoredache Sep 05 '14 at 16:52