I am calling Bash script from PHP, but it looks like PHP script won't complete until bash script runs complete.
exec(dirname(__FILE__) . '/sendemail.sh');
In bash script, I am sending 100s emails and I have sleep in each time. If I start the script from command line everything fine. But when I execute PHP from web server, php is never get completed and its waiting forever to load the page.
### Get emails one at a time from PHP generated list and start loop.
cat /home2/xx/www/sendmail/phpmailer/libs/people.txt | while read line
do
sleep 30
echo "$line"
### Set path of program that will run.
xmail="/usr/sbin/sendmail"
### Get subject generated from sendpage.php "not sure on name?
xsub=$(cat /home2/xx/www/sm/subject.txt)
### Show from in email.
xfrom="xx@yy.net"
### Get body generated from sendpage.php "not sure on name?
xmsg=$(cat /home2/xx/www/sm/body.txt)
### Compose emails one at a time.
"$xmail" "$line" << EOF
subject:$xsub
from:$xfrom
$xmsg
EOF
### End loop when while is complete.
done