Re: passthru loses php posted variables

From: Date: Mon, 15 Sep 2003 09:08:11 +0000
Subject: Re: passthru loses php posted variables
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-162614@lists.php.net to get a copy of this message
Hi, Did you try using the system() command instead and skip using exec and passthru? -- Nicole "Exasperated" <php@instruform.com> wrote in message news:20030914202252.32486.qmail@pb1.pair.com... > Anyone come across something like this before? > > I have made a little test script as follows: > <? > header ("Content-Type: application/pdf"); > $command_line = "/usr/bin/pdflabelseries " . > escapeshellcmd($_POST['labelstart']) . " " . > escapeshellcmd($_POST['labelend']); > exec ("echo \"$command_line\" >/opt/specs/labels.txt"); > //passthru($command_line); > ?> > > The form takes input from a posted form with two variables, labelstart and > labelend. In the above test, if I put in 'start' and 'end' as the posted > variable data, the output from /opt/specs/labels.txt (writable by the http > server) is: > /usr/bin/pdflabelseries start end > All is well and good. Now is where it heads South. I uncomment the > passthru command above. The output from the script in /opt/specs/labels.txt > from the same posted form with the same data entered is now: > /usr/bin/pdflabelseries > pdflabelseries is a C program that I have confirmed works perfectly on the > command line (i.e. generates the requisite pdf file to stdout). > Even if the C program fails (which it does not appear to do from the output > in the httpd logs as it outputs its command line to stderr), surely php > should not lose its own internal variables, especially, for a command that > is executed BEFORE the passthru command. > > I am truly baffled. > > Any help appreciated. > Regards > > Mark > > I am running vanilla Mandrake 9.1 with the following PHP rpms: > libphp_common430-430-11mdk > php-pear-4.3.0-3mdk > apache2-mod_php-2.0.44_4.3.1-2mdk > php-xml-4.3.0-2mdk > php-dba_bundle-4.3.0-4mdk > php-pgsql-4.3.0-4mdk > php-xmlrpc-4.3.0-2mdk > php-manual-en-4.3.0-2mdk > php430-devel-430-11mdk > php-gd-4.3.0-2mdk

« previous php.general (#162614) next »