ID: 22926 Updated by: [EMAIL PROTECTED] Reported By: phpbugs at bob7 dot com -Status: Open +Status: Bogus Bug Type: Program Execution Operating System: Windows 2000 server PHP Version: 4.3.1 New Comment:
Works w/ CLI, not PHP Bug => Bogus As to using a stream to get the output of processing another PHP file: Unfortunately the document you want processed (using this method) MUST be in a publicly accessable document tree. All the php stream does is pretend its a browser making a page request. What you *can* do, if you want to be able to do this the easy way but not have the document be publicly accessable is give it a password. // In your main script: <?php $message = file_get_contents("http://localhost/generateemail.php?password=secret"); ?> // In generateemail.php: <?php if ($_GET['password'] != 'secret') die("Don't hack!"); // Do the rest of your magic ?> Hope that helps. Previous Comments: ------------------------------------------------------------------------ [2003-03-31 10:47:04] phpbugs at bob7 dot com I repeated the test using the CLI interface and was able to get 'php -h' to run. I also see that I can use the new streams functionality to create HTML mail bodies. The problem with the streams approach is that (I believe) the .php files need to be in the document tree, so if I go that route, I have to add authentication. Perhaps there is or you guys may be planning a way that allows http streams from outside the doc tree? Thanks again, -Bob ------------------------------------------------------------------------ [2003-03-27 07:51:55] [EMAIL PROTECTED] Could you please try CLI version of PHP.EXE? It comes in the cli directory of the standard ZIP distribution. ------------------------------------------------------------------------ [2003-03-27 07:45:40] phpbugs at bob7 dot com The following does not work. It spawns scores of processes, which fortunately all die after 30 seconds. <? echo shell_exec("(path to php)/php.exe -h"); ?> I looked at the bug reports about possibly needing command.com but these do not work either: (same result) <? echo shell_exec("command -c (path to php)/php.exe -h"); ?> <? echo shell_exec("CMD /C (path to php)/php.exe -h"); ?> Why would I want to do this? To send html email using the PEAR mime mail class, i.e. <? $htmlBody = shell_exec("(path to php)/php.exe mimebody.php?param1=yada"); //rest of code to send mail... ?> I downloaded and installed the standard windows installer, and the path to php is C:\Inetpub\PHP I have the same problem using back ticks as well. Thanks very much for looking at this. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=22926&edit=1