Forum Moderators: coopster

Message Too Old, No Replies

Help needed on PHP system calls

tried exec, shell_exec, back_quote will no success!

         

Venvenven

7:39 am on Feb 21, 2004 (gmt 0)

10+ Year Member



Hi there,

I am currently having problem with my php. It is a web page that allow user to choose from a list of member and add it to a mailing list. It is running on my Linux(+apache), I wonder anyone could pleaseeee help me out why my code doesn't help..I am *very frustrated* with Mailman... It would work if I run the php script at prompt, but it just doesn't work if it is from web where the function is called when user clicked on a button in the page.
(note:php not in safe-mode, and "add_members" is function call in Mailman)

$mail_list = "testone-list";
$email_addr = "xyz@hotmail.com";

Tried the following with no success:
1. $msg = exec("echo $email_addr地dd_members -n - $mail_list, $arr, $retval); <== found $retval=1 after execution

2. $cmd_ret = `echo $email_addr地dd_members -n - $mail_list`;

3. $msg=exec(sprintf('echo %s地dd_members -n - %s', $email_addr, $mail_list);

4. shell_exec, system, passthru also didn't work similary

Any ideas please? Appreciate any inputs.

stargeek

6:19 pm on Feb 21, 2004 (gmt 0)

10+ Year Member



have you tried
$cmd_ret = "echo $email_addr地dd_members -n - $mail_list";

and manually running the output at the command line?

Venvenven

6:53 pm on Feb 21, 2004 (gmt 0)

10+ Year Member



> have you tried
> $cmd_ret = "echo $email_addr地dd_members -n - $mail_list";
> and manually running the output at the command line?

Hi,

This is supposed to be a command-line call to Mailman script.
It works if my test.php runs at command <b>ONLY</b> (I just cannot make it work from webpage) looks like this :

<?php
$trythis[0]="323123@aser.ca";
$listnm= "taskone-devep";
$i=0;
$cmdd = "echo $trythis[$i]地dd_members -n - $listnm";
$out_str = shell_exec($cmdd);
?>

How could I make it work if I put the above in a function of php web page? (e.g. click a submit button, then execute this command)

Thanks.