php fsockopen无法连接,连接超时错误 [英] php fsockopen unable to connect, connection timeout error

查看:3347
本文介绍了php fsockopen无法连接,连接超时错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在ubuntu计算机上运行本地apache服务器,我想使用phpmailer类发送邮件。
它试图通过fsockopen连接到邮件服务器,但它引发一个超时错误。我试图将超时设置为15秒,没有运气。
它在其他机器上工作。

I am running a local apache server on an ubuntu machine, and i am trying to use the phpmailer class to send mail. It tries to connect by fsockopen to the mail server, but it throws a timeout error. I tried setting the timeout to 15sec with no luck. It does work on other machines.

如何知道我的ISP是否已阻止请求?
邮件服务器响应ping。

How can i find out if my ISP has blocked requests ? The mail server responds to ping.

推荐答案

ping和SMTP命令不通过同一端口;

ping and SMTP command don't go via the same port ; it is possible that one port is opened, and not the other one.

如果有一个超时,它可能意味着:

If there is a timeout, it probably means that :


  • 您的SMTP服务器不接受来自您的服务器的连接

  • ,或者某些地方(如防火墙)阻止您的请求。

如果您有对服务器的ssh访问权限,请使用telnet命令行尝试连接到SMTP服务器,

If you have an ssh access to the server, using telnet in command line to try to connect to the SMTP server, and send SMTP commands, might allow you to get some more informations...

这里有两个链接,通过telnet显示SMTP会话的示例:

Here a couple of links that show examples of an SMTP session via telnet :

  • Sending an e-mail via Telnet
  • Send mail through SMTP using Telnet

如果无法连接到服务器,您可能会收到一些错误消息(告诉你,你不能连接,例如),否则它会再次超时...这可能意味着你的请求被封锁在某个地方...

If you cannot connect to the server, maybe you'll get some error message (telling you that you are not allowed to connect, for instance), or it'll timeout again... Which probably means your request are being blocked somewhere...

在这种情况下,请与您的网络管理员联系;也许他会有一些想法在防火墙上打开一些端口。

In that case, check with your network administrator ; maybe he'll have some idea about opening some port on the firewall.

这篇关于php fsockopen无法连接,连接超时错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆