note 56988 deleted from function.exec by cmb

From: Date: Sun, 24 Nov 2019 08:54:55 +0000
Subject: note 56988 deleted from function.exec by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-213217@lists.php.net to get a copy of this message
Note Submitter: ewilde ---- 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: <?php 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 ..."); ?>

« previous php.notes (#213217) next »