SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Zealot busylinks1's Avatar
    Join Date
    Nov 2008
    Posts
    160
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Can't connect to remote MySQL server through php

    I got this error "Can't connect to MySQL server on 'mysql501.ixwebhosting.com' (4)" when connecting to a remote mysql server. And I am sure the remote mysql server allow this access from remote locations because when check and test the same code from my pc then it works fine but when I upload it the it gives the error.
    Server address is: mysql501.ixwebhosting.com


    Anyone know what cause this? What does the error number 4 mean? I could not find its explaination in mysql doc.

    Thanks,

  2. #2
    PHP Developer W1LL's Avatar
    Join Date
    Apr 2001
    Location
    Leicester, UK
    Posts
    459
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Angry

    I'm having the exact same problem, and have been for a few weeks now.

    It's only intermittent. We have a cron running every 5 minutes, and we will get this error maybe 5 times a day.

    The most likely cause that I've found so far is that there are too many concurrent connections. But our max_connections is set to 100, and the "max. concurrent connections" on phpMyAdmin has only got up to 57.

    Anyhow, this is what I've managed to find out so far...

    Error code 4 = Interrupted system call.

    MySQL docs: http://dev.mysql.com/doc/refman/5.0/...to-server.html

    People with the same problem (awaiting replies/solutions):
    - http://forums.mysql.com/read.php?20,264074,264074
    - http://forums.devshed.com/mysql-help...4t-613258.html

    Looks like it's most likely a max_connections issue: http://www.linkedin.com/answers/tech...tegory=TCH_ITS

    http://lists.zerezo.com/mysql/msg32530.html
    "This has all the look and feel of intermittent network issues. I would run an independant network scan (maybe nmap?) from one of the affected clients to the affected host and I bet you will find that the same fluctuations occur on other ports."

  3. #3
    PHP Developer W1LL's Avatar
    Join Date
    Apr 2001
    Location
    Leicester, UK
    Posts
    459
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    An update from me. I've just set max_connections to 200 in my.cnf and rebooted the server. 15 minutes later (and after 3 times of running the script) it's failed again; with only a max of 8 concurrent connections.

    I'm really stumped on this one!

  4. #4
    SitePoint Member
    Join Date
    Sep 2004
    Location
    Auckland
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's funny, all the threads you mentioned was me trying to find answers from different places.

    I'm still having the same problem and I can't see it being a problem with max connections (as we're setting that to 3000).

    What version of MySQL are you running? I'm thinking maybe it's a version related problem.

  5. #5
    PHP Developer W1LL's Avatar
    Join Date
    Apr 2001
    Location
    Leicester, UK
    Posts
    459
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Noodles, how weird that I found all those!

    We're using version 5.0.20a-max.

    The most probable cause we found was network problems between the 2 servers. We've put a support ticket into our server guys, but are yet to hear back.

  6. #6
    SitePoint Member
    Join Date
    Sep 2004
    Location
    Auckland
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Are you seeing any packet loss or network problems between the servers, or is it just a hunch?

    Let me know if they find any problems.

  7. #7
    SitePoint Zealot
    Join Date
    May 2009
    Location
    usa
    Posts
    113
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sometime, it happens because you may have not allowed external connections. Please check the external connections to mysql database are allowed in your hosting panel.

  8. #8
    SitePoint Addict psyon's Avatar
    Join Date
    May 2004
    Location
    Cedar Rapids
    Posts
    295
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If your server is linux based, it is possible the SELinux is blocking apache from creating connections. I had this problem on a server a few months back, and it took a while for me to think to check /var/log/messages to see the notices about the process being blocked.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •