Re: Running PHP scripts with root permissions!!!
| From: | Steven Werby | Date: | Wed, 16 Aug 2000 14:37:27 +0000 |
| Subject: | Re: Running PHP scripts with root permissions!!! | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-12017@lists.php.net to get a copy of this message | ||
Web Admin <webadmin@morva.net> wrote:
> Does anyone know how to run php scripts with root permissions?
> For example, i want to write a php script which shows last system
> messages using tail /var/log/messages.
> How can I do that without chmod 777 /var/log/messages!!
Install PHP to run as a standalone (CGI). That is the default PHP install
method (./configure with no options will install as a standalone binary).
You'll call the HPP files as you would Perl CGI. Then the PHP files will run
with the permissions of the owner of the PHP file so just make your PHP file
owned by root to give it root privileges. Be careful though as this can be
dangerous.
> httpd is being run by nobody. Should I change it? The owner can't
> be root in Apache (latest version).
It's a good thing it can't be owned by root. That would compromise your
server's security. I would not change the ownership of httpd.
--
Steven Werby {steven-lists@befriend.com}
President, Befriend Internet Services LLC
http://www.befriend.com/ 804-355-WEBS