Page 1 of 1

PHP script as user

Posted: Thu Jun 02, 2005 12:44 am
by tiborv
How to run web PHPscript in specified user, not in apache(default).

In linux you create user test, and he has rights like root.
Now you want to run http://www.yoursite.com/test.php, and script test.php is a execute script.
But by default scripts are treated like user apache,but apache hasent got enough rights to do test.php demand , and now i want that script will be executed by user test, which has the root rights.

Thanks for answer !!

Posted: Thu Jun 02, 2005 2:34 pm
by Ambush Commander
Since Apache is invoking PHP to run the scripts, PHP *must* inherit the user rights of Apache. My guess is to increase the user rights for user Apache, although if you need *root* rights, you're probably looking in the wrong places.

Posted: Thu Jun 02, 2005 5:57 pm
by shiznatix
if you give your users root rights then its basically saying "please take down the server"

you may be able to set your server settings to allow this somehow but im sure everyone thinks its a real real bad idea

Insane apache :)

Posted: Fri Jun 03, 2005 12:28 am
by tiborv
Changing Apache rights to Root is insane !
It was just an example :).
Yes i am going to increase Apache rights. What about .htacces ? Will it be god ?


Thanks !

Posted: Fri Jun 03, 2005 1:23 am
by Syranide
which user and group it should run as is all in the .conf-file, however can be quite tricky as you aren't truly free.

a per directory-conf should not work I believe (would be rediculous having 100 apacheinstances running for the fact there are 100 folders all running using different users.

Posted: Fri Jun 03, 2005 3:19 am
by timvw
suexec and suphp are the tools that you might want to look into..

Posted: Tue Jun 07, 2005 6:33 am
by tiborv
Thanks for the answers !