Execute a script from command line on a Linux system with Plesk (safe mode)

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

 



Hello,

I am trying to execute this script (from command line):

function getMailboxSize($domain, $mailbox){
 // Maildirectories are stored under /var/qmail(mailnames/domain/mailuser
 $path = "/var/qmail/mailnames/" . $domain . "/" . $mailbox;
 $size = shell_exec("cd " . $path . ";du -bc * | grep total | cut -d\\t -f 0,1");
 return trim($size);
}

I get the warning:  shell_exec(): Cannot execute using backquotes in Safe Mode.

Ok, I don't want to modify to suphp or so... what other alternatives do I have? Shall I put this code in a shell script, sudo it and let it execute by my php script? Or how can I get around?

I have also tried to connect via mysql in order to get the usage/limitation with the imap_get_quotaroot function...

I used this code:

function getMailboxSize($domain, $mailbox, $passwd){
 $mbox = imap_open("{my_server_ip:993/imap/ssl/novalidate-cert}", $mailbox."@".$domain, $passwd, OP_HALFOPEN) or die("can't connect: " . imap_last_error());

  $size = 0;
  $quota = imap_get_quotaroot($mbox, "INBOX");
  
  if( $quota != FALSE && is_array($quota) ){
   print_r($quota);   
  }else{
   echo "no quota?\n";
  }
  imap_close($mbox);
  return $size;
}

imap_get_quotaroot returns false.

I don't know really what else I could try... The goal is to get the usage of each imap mailbox on the machine (used/quota) to know if it is full or not (if not, how full?).

Would be nice if someone could help :)


LS
-- 
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! 
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer

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