Re: Help on running external command

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2008. 02. 20, szerda keltezéssel 14.31-kor Mário Gamito ezt írta:
> Hi,
> 
> I need to run an eternal command from a PHP page.
> 
> My code is:
> "
> $username= 'lixo';
> 
> $username = 'lixo';
> 
> exec('su - vpopmail -c 
> "/var/qmail/bin/maildirmake/home/vpopmail/domains/wwlib.lan/" . $username');
> "
> 
> But I get the error:
> "/var/qmail/bin/maildirmake/home/vpopmail/domains/wwlib.lan/: Not a 
> directory"
> 
> Which means that the $username variable isn't being appended to the string.

you're putting . and a variable inside a string delimited by ' which
will never work.
to avoid confusion like this, why not build the string first, then
exec() it? that way you can always echo out the string to check what
might be the problem.

$cmd = 'su -
vpopmail /var/qmail/bin/maildirmake/home/vpopmail/domains/wwlib.lan/' .
$username;

exec($cmd);

greets
Zoltán Németh

> 
> Any help would be appreciated.
> 
> Warm Regards,
> Mário Gamito
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux