Jump to content

exec statement not executing


devans725

Recommended Posts

The first statement executes fine, the other one doesn't?  Not sure why not?  Statement runs from command line with no errors.  I don't receive any errors when php is run.  I just don't get the results I want.  I know the first statement works because the dumbfile.txt contains the correct information.  The final hello.pdf does not contain the correct information.  Any suggestions will be appreciated.

 

<?php
#!/bin/bash

$state = $_POST["state"];
$gross = $_POST["gross"];

exec ("mysqldump --xml --skip-opt --no-create-info --compact --user=user --password=pass --where=gross='$gross' database_W2 > dumbfile.txt", $result);

exec ("python /home/dir/public_html/draw.py", $result);


echo ("
         <script language=JavaScript>
        <!-- Hide from JavaScript-Impaired Browsers
         parent.location=\"hello.pdf\"
         // End Hiding -->
         </script>
      ");

?>

Link to comment
https://forums.phpfreaks.com/topic/99576-exec-statement-not-executing/
Share on other sites

According to the exec() manual page:

Note that if the array already contains some elements, exec() will append to the end of the array. If you do not want the function to append elements, call unset() on the array before passing it to exec().

It's talking about the second parameter to exec().

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.