243 posts
  • Europe
  • Has been a member for 5-6 years
  • Referred between 1 and 9 users
  • Sold between 1 000 and 5 000 dollars
creativestuff says

Hi actually I am making a temporized newsletter system (so I have the DB set up to save all the data needed like the message emails and so on)

I have a cronjob (cron.php) which is called every minute, this cronjob (actually) accesses the DB get out the active sessions , creates the email and sends the email with phpmailer (5 every minute to be sure the server won’t get blacklisted) working fine…

..until I decide to use more SMTPs (having 30) to have 150 emails sent / minute (each smtp gets 5 mails)

since there are 150 calls for sending mails + DB accessing + script run-time I might get out of allowed php execution time so I decide to brake down the mail sending part into another file (mail.php which will be called by cron.php) so from the actual: 1 process sending 150 emails – I want to get to 30 processes make 5 emails each

I was thinking to call mail.php with cURL… but each cURL waits for its response (I search for silent cURL but haven’t found anything useful)

Solutions would be:

a) having 30 cronjobs + 30 php files… I don’t like it since I don’t wanna add cronjobs each time another smtp has to be added

b) php Sockets – send 30 socket message without w8ing for the response.. (I don’t know if it would make a different process)..

ANY IDEA ?!?

22 posts
  • Exclusive Author
  • Has been a member for 4-5 years
  • Sold between 1 000 and 5 000 dollars
  • Referred between 1 and 9 users
  • Bought between 10 and 49 items
r0ash says

set_time_limit(0); will make sure, your script dont get time out.

However if you are running your scripts via cron, I dont see why they will get timeout.

243 posts
  • Europe
  • Has been a member for 5-6 years
  • Referred between 1 and 9 users
  • Sold between 1 000 and 5 000 dollars
creativestuff says

well yeah… but what if the server rules limit the execution time to the default 30S… I would like a solution for the more distinct processes (it might be useful at other projects)

...in other words how can a php script execute (without the EXEC function cuz that’s vulnerable and usually disabled on the hosting servers) another php script without requesting any feedback from it…

...like when the bully kicks the little boy on the tricycle down from the hill … he know that the little boy will brake his everything… but he goes away cuz he don’t care when and how… :D

2950 posts
  • Australia
  • Community Moderator
  • Elite Author
  • Author had a Free File of the Month
  • Most Wanted Bounty Winner
  • Author had a File in an Envato Bundle
  • Has been a member for 5-6 years
  • Contributed a Blog Post
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
+10 more
dtbaker Volunteer moderator says
243 posts
  • Europe
  • Has been a member for 5-6 years
  • Referred between 1 and 9 users
  • Sold between 1 000 and 5 000 dollars
creativestuff says

thx dtbaker this should do the trick (almost forgot about fork… it’s been a long time I last used it)

by
by
by
by
by
by