note 20648 added to ref.exec
| From: | rolland dot dudemaine at msg-software dot com | Date: | Thu, 11 Apr 2002 09:45:04 +0000 |
| Subject: | note 20648 added to ref.exec | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-29100@lists.php.net to get a copy of this message | ||
In case you ever had to chain from php to another program (e.g. with a cgi php that only gives part
of the output, or with php-gtk), here is a little C program that kills his parent (php, for
instance), then launches a program given in argument.
chain.c :
#include <unistd.h>
int main(int argc, char**argv) {
/* kill the parent */
kill(getppid(), 15);
argv++;
/* then launch the new program */
return execvp(argv[0], argv);
}
(compile with gcc -O3 -o chain chain.c)
then in php, use
<?
exec('chain sh -c echo test');
?>
--
http://www.php.net/manual/en/ref.exec.php
http://master.php.net/manage/user-notes.php?action=edit+20648
http://master.php.net/manage/user-notes.php?action=delete+20648
http://master.php.net/manage/user-notes.php?action=reject+20648