Page 1 of 1
CGI vs PHP mailer
Posted: Sat Aug 02, 2003 11:50 am
by Spaceman-Spiff
I have a newsletter script running in my website, sending 1500 emails every week, it's currently using php mail() function, but it's very slow. I've tried both sendmail and SMTP, and both has the same speed.
I read
somewhere that a CGI Mailer will be faster than a php script. Is this true? Or is my webhost mail server just slow?
What are the advantages using a CGI mail script instead of PHP? or vise versa
Posted: Sat Aug 02, 2003 11:52 am
by nielsene
Most likely is just a slow mail mailserver.
Are you sending each message individually, or in batches in cc/bcc fields? I would suspect the latter might speed things up a little if you weren't already doing that.
Posted: Sat Aug 02, 2003 11:57 am
by Spaceman-Spiff
No CCs and BCCs
I currently make the script sends 25 mails, rests for 4 secs, then send another 25, until all are sent.
It takes about 5-30 seconds to send 25 mails
since i read that site above, i'm thinking to use a CGI script instead, if it is faster. but i dont know much about CGI to know if its true or not
Posted: Sat Aug 02, 2003 12:16 pm
by nielsene
I doubt that CGI will be faster. (How is your PHP installed as an apache module or as regular CGI gateway? If the latter then you'll see no change. And the former is almost always faster anyways.....)
If its possible to do cc's or bcc's that will be faster as its fewer calls to the mail function.
Posted: Sat Aug 02, 2003 12:30 pm
by Spaceman-Spiff
thx for answer, nielsene
i'll try using cc
the host is verio, the email server is separated from the webserver (external)
i dont know how php is run there, they seem to hide apache part in phpinfo, so i cant check the loaded modules, but under Server API it says: CGI
Posted: Sat Aug 02, 2003 12:42 pm
by nielsene
OK then yes your webhost is running the cgi version of PHP, which is almost always slower than the webmodule version.
So unless you planned to rewrite your application in C and compile it for CGI then I don't think changing from PHP to cgi will see ANY improvement.
Posted: Sat Aug 02, 2003 12:51 pm
by Spaceman-Spiff
thanks again for the answer
i'll just stay with php for now
it takes about 15 minutes to send out a newsletter
but we only need to do it once a week
Posted: Sat Aug 02, 2003 8:31 pm
by McGruff
I've used Verio before for an online shop - seemed pretty good. I'd be surprised if server speed was an issue, which leaves the efficiency of the particular script you're using - as nielsene has suggested.
You might find a script timer function useful to investigate:
Code: Select all
<?php
function getmicrotime(){
list($usec, $sec) = explode(" ",microtime());
return ((float)$usec + (float)$sec);
}
?>