note 56988 added to function.exec
| From: | ewilde at osu1 dot php dot net | Date: | Tue, 20 Sep 2005 23:55:46 +0000 |
| Subject: | note 56988 added to function.exec | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-95510@lists.php.net to get a copy of this message | ||
To my way of thinking, it is a good idea to execute programs from the cgi-bin directory of the Web
server, to get a little control over configuring a system (at install time, a pointer to the actual
program can be symlinked from the cgi-bin directory and the code won't ever have to be
changed). If you'd like to do this, under Apache at least, the following should work:
if (!($ProgInfo = apache_lookup_uri(/cgi-bin/myprog)))
$ProgPath = /usr/bin/myprog;
else
{
if (is_object($ProgInfo)) $ProgPath = $ProgInfo->filename;
else $ProgPath = $ProgInfo["filename"];
}
exec("$ProgPath ...");
----
Manual Page -- http://www.php.net/manual/en/function.exec.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+56988
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+56988&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+56988&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+56988&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+56988&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+56988&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+56988&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+56988&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+56988&report=yes
Search -- http://master.php.net/manage/user-notes.php