开发者

fsockopen returns 'bool(false)' from browser but 'resource(4) of type (stream)' from command line

开发者 https://www.devze.com 2023-02-16 05:13 出处:网络
I cannot send mail in sugarcr开发者_如何学Pythonm. Suagrcrm sends mail with phpmailer using SMTP. I have identified that the error occurs when an attempt to open a socket connection using fsockopen is

I cannot send mail in sugarcr开发者_如何学Pythonm. Suagrcrm sends mail with phpmailer using SMTP. I have identified that the error occurs when an attempt to open a socket connection using fsockopen is made. The call to fsockopen returns boolean (false).

The arguments given to fsockopen are 5 variables containing the following values 'mail.example.com'(hostname), 25(port), ''(errno), ''(errstr), 10(timeout)

The error message is

Code: 10107 Reply: A system call that should never fail has failed.

The error code is present in microsoft website under 'Windows Sockets Error Codes' and is partly explained as:

Returned when a provider does not return SUCCESS and does not provide an extended error code. Can indicate a service provider implementation error.

The issue occurs when I call the script from a broswer. If I execute the script from command line, fsockopen returns a resource.

Program Info:

Windows XP

Apache/2.0.63 (Win32) mod_ssl/2.0.63 OpenSSL/0.9.8i PHP/5.2.8 Server

PHP Version => 5.2.8

Can anyone suggest any possible solutions for this issue. Thanks in advance for any suggestion.


When running under windows, try port 587 instead of 25!


The error was caused due to the presence of a firewall in the system used as the web server. It worked fine when I uninstalled the firewall.

0

精彩评论

暂无评论...
验证码 换一张
取 消