PHP Fsockopen检查端口25

I have written a code to check port 25 of one of my local server . The smtp server is running on the server, but when i check with fsockopen, returns a connection refused error . So how i check whether SMTP is down or up using a simple php code .

Are the php script and the smpt on the same machine? Have you checked the connection with telnet?

telnet your.local.server 25

Generally "Connection refused" means, what it says ;)

  • smtp server is not running, or
  • your server is not reachable (firewall?)

It's better to write your server detail such as OS

check your firewall ,maybe it refuses your connection

And check connection with :

telnet your-server 25