Re: Help on running external command / Partially solved

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

 



Daniel Brown wrote:
On Feb 20, 2008 10:30 AM, Mário Gamito <gamito@xxxxxxxxx> wrote:

    Please keep the replies on-list, Mario.  It helps others out, and
ensures that you'll get better advice from a larger group of talented
people.

<?
$username = "lixo";
exec('su -c - vpopmail "/var/qmail/bin/maildirmake
/home/vpopmail/domains/wwlib.lan/'.$username.'"',$ret,$err);
echo "<pre />\n";
print_r($ret);
echo "</pre>\n";
echo isset($err) ? "Error: ".$err : null;
?>
No output at all and I have "display_errors = On" in php.ini

Still no directory creation.

If I run the file as user vpopmail it asks me for a password:

# su - vpopmail
$ php /home/www/hash.php

Output:"
[vpopmail@cruzador ~]$ php /home/www/hash.php
Password:"

    It's because you can't automate su - without using an intermediary
such as 'expect'.

You can use sudo to allow specific commands to be run.

http://www.sudo.ws/sudo/man/sudoers.html#examples

Though I highly recommend you just dump this stuff to a database or something and have a cron job running every 5 minutes to check for new accounts to create etc.


--
Postgresql & php tutorials
http://www.designmagick.com/

--
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