Cron Jobs and fsockopen() timeout

Status
Not open for further replies.

jitensuthar27

New Member
Messages
4
Reaction score
0
Points
0
Hey guys,

First off, x10hosting, your free hosting service is absolutely amazing considering it's free. I have not seen so many features and advanced functionality in any other free hosting provider, so I really appreciate what you guys are doing.

On to my problem:

I have PHPList set up and running so it sends mail through my gmail account (SMTP).
If I manually process the queue (i.e. hit the "Process Queue" link), then all works well and the emails are sent out/received.

However, when I set up a cron job to process the queue every 5 minutes, it doesn't work.
I've actually scrutinized the code for PHPList, which uses PHPMailer to send out the emails via SMTP.

I've also isolated the issue to a timeout from fsockopen(). So basically, when called from a cron job, it is unable to connect to gmail's SMTP server. Normally, I'd look for solutions of port problems, coding errors, etc. However, the odd thing is that is works perfectly OK when I process through the PHPList interface.

So I guess my question is, what is it about the cron job that's causing fsockopen() to timeout? It has to be something with the fact that I'm calling processqueue from a cron job seeing as it works from the PHPList interface.

Perhaps I'm overlooking something critical here, but any/all help will be greatly appreciated. Thanks in advance!

For the record, here is the cron job I'm using:
/usr/local/bin/php -c /home/myusername/php.ini -q /home/myusername/public_html/lists/admin/index.php -p processqueue >> /home/myusername/cronlogs/process_listserv.txt
 
Last edited:

jitensuthar27

New Member
Messages
4
Reaction score
0
Points
0
No ideas?

---------- Post added at 08:45 PM ---------- Previous post was at 03:28 PM ----------

Hey guys I resolved the issue!

For those in the future who may have the problem:

I basically changed the cron job to run the page directly:

/usr/bin/lynx -source 'http://mysite.pcriot.com/lists/admin/index.php?page=processqueue&login=PHPListUserName&password=PHPListPassword' > /home/myusername/cronlogs/process_listserv.htm

Note that the quotes around the 'http://mysite.pcriot.com/admin/..' portion are important. I didn't include them at first when playing around with this solution and couldn't figure out why it wasn't working, so just a heads up.

I must admit, I'm still not 100% sure of the technical details of why this works, but it does, so there you have it.
 
Last edited:
Status
Not open for further replies.
Top