Trying to use exec with mail
Posted: Mon Oct 27, 2008 9:59 pm
My first post here.
I want to use test.php to run a php script in the background:
Here's the test_exec.php file:
The problem is that mail doesn't execute, and I get no error messages.
I've also redirected the exec output to a text file, and still no error messages or clues as to why this isn't working.
I can do simple statements like:
Eventually I want to use this technique to send a email messages to a list of people in my association who have opted in. My present site is just using the "mail" command inside of a foreach statement and that causes my web page to stay open for several minutes. This background exec seemed like a more elegant approach. I'm hosting with http://www.1and1.com on a Linux server.
Any help or clues are appreciated
I want to use test.php to run a php script in the background:
Code: Select all
<?php
exec('/usr/bin/php /pathname/test_exec.php > /dev/null 2>&1 &');
?> Code: Select all
#!/usr/bin/php -q
<?php
mail("to@mail.com","subject","message","From: me@mail.com");
?> I've also redirected the exec output to a text file, and still no error messages or clues as to why this isn't working.
I can do simple statements like:
Code: Select all
exec('ls > results.txt')Any help or clues are appreciated