Neither Exec or System Functions Run?

Hey All,

I just found this site and I’m enjoying it already.

I have an issue that I can’t seem to track down and thought maybe someone could assist me with.

I have a member based script that needs to occasionally send out some email to all or select members through a web form in the admin area.

The php grabs the form data updates the mysql db with certain parameters such as who gets the email, the subject and message, then executes a file on the site called emailer.sys.php to actually run the email function and send out mail.

The code looks like such:
function ocd_send ()
$status = $this->GetGP (“status”);
$subject = $this->enc ($this->GetValidGP (“subject”, “subject”, VALIDATE_NOT_EMPTY));
$message = $this->enc ($this->GetValidGP (“message”, “Message”, VALIDATE_NOT_EMPTY));
$saveSettings = $this->GetGP (“saveSettings”, 0);

if ($this->errors['err_count'] > 0)
   $this->ocd_list ("send");
    $this->db->ExecuteSql ("Update settings Set value='$status' Where keyname='SendMailStatus'");
    $this->db->ExecuteSql ("Update settings Set value='$subject' Where keyname='SendMailSubject'");
    $this->db->ExecuteSql ("Update settings Set value='$message' Where keyname='SendMailMessage'");
    if ($saveSettings == 1)
        $this->db->ExecuteSql ("Update settings Set value='$status' Where keyname='SendMailStatusDefault'");
        $this->db->ExecuteSql ("Update settings Set value='$subject' Where keyname='SendMailSubjectDefault'");
        $this->db->ExecuteSql ("Update settings Set value='$message' Where keyname='SendMailMessageDefault'");
    $appRoot = "/home/myaccount/public_html";
    $path = "/usr/bin/php";
    session_write_close ();
    exec ("/usr/bin/php /home/myaccount/public_html/admin/emailer.sys.php > /dev/null 2>&1", $retval);
    session_start ();
    $this->Redirect ($this->pageUrl."?ec=sent");


I just recently switched hosts and suddenly this function will not work.

It produces NO errors whatsoever in any server logs, nor does it print any errors to the page. It simply doesn’t run the file.

If I run the file manually by calling emailer.sys.php in a browser it runs no problem, but it won’t fire via the script above.

Anyone have any ideas?



Are you allowed to run exec() or system functions on your new host’s machine? Do you have the correct permissions, and are such functions not disabled in php.ini? Most likely PHP is not allowed to run exec() as it is a possible security issue.

Yes exec functions are allowed this is a dedicated box.

Exec and system functions seem to run fine now , but they won’t run php. If I create an exec function that calls wget for instance, that works fine, but calls to the CLI will not run.

Have you ever seen anything like that before?


I see. Have you tried the command you’re trying to exec() straight from the CLI? Perhaps there’s a typo or bug in there.

On a sidenote, what’s your reason for not simply using include()?

Sponsor our Newsletter | Privacy Policy | Terms of Service