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

michael123, since nobody has replied, I thought I might just answer to let you know that I struggled with how to run PHP apps with root privs WHEN NEEDED or to run as specific users. I'm trying to recall all the brick walls I ran into, but seems a major one was that I'd have to switch over to using PHP in CGI mode rather than as an Apache module. I was not willing to do that.

I built a PHP controlpanel for my hosting business, so I needed the app to be able to add new accounts and new domains to my server. But how could I do this without any root privs? What I ended up doing, which I'm very satisified with, is writing my PHP app to write a line into a "pending accounts" text file. I have a cron job that fires once a minute to see if the file exists. If it does, then it starts a PHP shell script that does the job -- as root. That script also deletes the pending file when complete. This would not be a perfect solution in a heavy, multi-user environment, but works perfect for my situation.

Maybe there is an "out of the box" solution to what you are trying to do?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.