note 23983 added to function.posix-setuid
| From: | simon at dont-spam-me-pleease dot simonster dot com | Date: | Fri, 02 Aug 2002 19:53:59 +0000 |
| Subject: | note 23983 added to function.posix-setuid | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-34160@lists.php.net to get a copy of this message | ||
Here's some Perl code to run a PHP script setuid. Just put it into a CGI, make that CGI setuid
and executable, then call the CGI where you would usually call the PHP script.
#!/usr/local/bin/perl
# Perl wrapper to execute a PHP script setuid
# ©2002 Simon Kornblith
# Requires PHP CGI
# Make UID = EUID (so that PHP can run system()s and execs() setuid)
$< = $>;
# Set this to the path, so that we can't get poisoned
$ENV{'PATH'} = "/home/httpd/cgi-bin/ssl/admin";
# Open the PHP script (must start with !#/usr/local/bin/php or similar and
# be executable
open(STDOUT, "| /home/httpd/cgi-bin/ssl/admin/new.php");
# Write STDIN to PHP script
print while <STDIN>;
--
http://www.php.net/manual/en/function.posix-setuid.php
http://master.php.net/manage/user-notes.php?action=edit+23983
http://master.php.net/manage/user-notes.php?action=delete+23983
http://master.php.net/manage/user-notes.php?action=reject+23983