Community Forums
Connect with us on LinkedIn
Community Notice
+ Reply to Thread
Results 1 to 13 of 13
  1. #1
    Member
    Join Date
    Oct 2004
    Posts
    50

    Default Warning: fsockopen(): unable to connect to

    Hello,


    None of my users (including a few of my own sites) have the right to open a connection (fsockopen) to another server.

    "Warning: fsockopen(): unable to connect to *** "

    Why is this?

  2. #2
    Member
    Join Date
    Jul 2003
    Posts
    23

    Default

    Hi,

    This probably is caused by your firewall configuration.You may need to allow both incoming and outgoing access for the ip and/or the port number you wish to connect to.

    We had similar issues before and have solved them this way.Hope it helps.
    Thanks
    Brain Hosting, Inc.
    Exceeding Your Expectations
    Visit us at
    www.brainhosting.com

  3. #3
    Member
    Join Date
    Oct 2004
    Posts
    50

    Default

    Quote Originally Posted by brainx
    Hi,

    This probably is caused by your firewall configuration.You may need to allow both incoming and outgoing access for the ip and/or the port number you wish to connect to.

    We had similar issues before and have solved them this way.Hope it helps.
    Thanks
    no, our firewall does not have any rules against this. It allows all outbound traffic, inbound is filtered.

    It has to do something with PHP, just can't figure it out?


    Wieger.

  4. #4
    Member
    Join Date
    Jun 2003
    Posts
    280

    Default

    Are you able to connect using telnet from the server to the exact same remote server?

  5. #5
    Member
    Join Date
    Oct 2004
    Posts
    50

    Default

    With SSH it all goes well.. telnet returns valid information.

    It's only when i want to fsockopen() with a script.

  6. #6
    Member
    Join Date
    Oct 2002
    Posts
    751

    Default

    Did you check the allow_url_fopen setting in php.ini ?

  7. #7
    Member
    Join Date
    Oct 2004
    Posts
    50

    Default

    Quote Originally Posted by jamesbond
    Did you check the allow_url_fopen setting in php.ini ?
    phpinfo says;

    allow_url_fopen On On

  8. #8
    Member
    Join Date
    Oct 2004
    Posts
    50

    Default

    So, any options?

  9. #9
    Member
    Join Date
    Jan 2005
    Posts
    1,880

    Default

    From the PHP manual (http://pl2.php.net/manual/en/function.fsockopen.php):

    If the call fails, it will return FALSE and if the optional errno and errstr arguments are present they will be set to indicate the actual system level error that occurred in the system-level connect() call. If the value returned in errno is 0 and the function returned FALSE, it is an indication that the error occurred before the connect() call. This is most likely due to a problem initializing the socket. Note that the errno and errstr arguments will always be passed by reference.
    Try specifying the optional paramaters errno and errstr and then print them afterwards. This should give you more specific errors which should aid the troubleshooting process.

    PHP Code:
    $fp fsockopen ("example.com/index.html"80$errno$errstr30);
    if (
    $fp === false) {
      print(
    $errno." : ".$errstr);


  10. #10
    Member
    Join Date
    Oct 2004
    Posts
    50

    Default

    Quote Originally Posted by webignition
    From the PHP manual (http://pl2.php.net/manual/en/function.fsockopen.php):



    Try specifying the optional paramaters errno and errstr and then print them afterwards. This should give you more specific errors which should aid the troubleshooting process.

    PHP Code:
    $fp fsockopen ("example.com/index.html"80$errno$errstr30);
    if (
    $fp === false) {
      print(
    $errno." : ".$errstr);

    As i said, permission denied?

  11. #11
    Member
    Join Date
    Oct 2004
    Posts
    50

    Default

    So, again no options..

  12. #12
    Member
    Join Date
    Jan 2005
    Posts
    1,880

    Default

    I suppose if you've exhausted all of the options presented here and you're still unable to resolve the problem, all I could suggest would be:

    1. Thoroughly search the forums in case there is a thread on this that you missed
    2. Use Google or some other search engine to hunt for solutions
    3. Contact your data center for support
    4. Hire someone if you're unable to resolve the issue yourself

  13. #13
    Member
    Join Date
    Oct 2004
    Posts
    50

    Default

    done all that, nobody seems to know.. but i found someone with the same problem on the forum (also, no sollution?)

Similar Threads & Tags
Similar threads

  1. Replies: 6
    Last Post: 12-21-2010, 01:19 PM
  2. fsockopen won't connect on port 80 to akismet
    By WindyT in forum cPanel and WHM Discussions
    Replies: 6
    Last Post: 07-09-2009, 05:33 PM
  3. Warning: socket_connect() unable to connect [113]: No route to host
    By liceen in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 09-14-2007, 11:43 PM
  4. Warning: fsockopen(): unable to connect to localhost:25
    By mahdionline in forum cPanel and WHM Discussions
    Replies: 7
    Last Post: 08-03-2006, 12:14 PM
  5. Replies: 2
    Last Post: 01-26-2006, 12:25 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube