SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Aug 2008
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question MySQL appears to timeout on remote server

    I'm fairly new to PHP and MySQL. I've built an osCommerce site, the owner wants to import all prices etc. from his Excel spreadsheet, daily.

    I've written PHP and MySQL routines to do just that, it all works perfectly in my office on Apache 2.2.9, PHP 5.2.1, MySQL 5.0.37. The code is not that complex.

    When I try on the remote server Apache 2.0.51, PHP 4.3.11, MySQL 4.1.20 it sometimes works, sometimes fails.

    We have well over 2000 products. Usually if I attempt to insert or update 2220 products or so all is well. Add another 12 products and it fails. But sometimes it doesn't get even past displaying the MySQL version number at the top! It doesn't even get to the point of updating prices.

    I've been trying to optimize and speed up my code, I changed some code so tables are now read into arrays rather than repeatedly accessing the database. Speeds things up a bit here but remotely it still fails in exactly the same manner as before.

    I don't have access to the remote server MySQL or PHP settings. Here in the office I can reduce timeout settings until I get errors, but I always get an error message.

    On the remote server I never get an error message, it just stops. Persistent connection makes no difference. The time from start to failure varies from a few seconds to as much as several minutes.

    If I enter 8000 products here in the office, that too works fine, although it takes awhile.

    I'm running out of ideas! Anyone have a suggestion?

    Thanks for your time and patience with a newbie:-)

  2. #2
    reads the ********* Crier silver trophybronze trophy longneck's Avatar
    Join Date
    Feb 2004
    Location
    Tampa, FL (US)
    Posts
    9,854
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    have you looked at the mysql server log?
    Check out our new Industry News forum!
    Keep up-to-date with the latest SP news in the Community Crier

    I edit the SitePoint Podcast

  3. #3
    SitePoint Member
    Join Date
    Aug 2008
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Unfortunately the host says they do not have error logging turned on because it would tie up resources.

    I've spent all morning experimenting, I think it is a timeout problem. I wrote a simple script that takes a long time to complete. It too fails on the remote server, but does not generate an error message.
    Here I get a timeout error message.

    I think I will have to break my tasks up into sections, that will not be easy! I note that all scripts take a lot longer to execute on the remote server.

    I do set_time_limit(0) which should make PHP wait for me, which is why I think it must be MySQL. Doesn't seem to be a similar feature in MySQL.

    Thanks for your help!

  4. #4
    reads the ********* Crier silver trophybronze trophy longneck's Avatar
    Join Date
    Feb 2004
    Location
    Tampa, FL (US)
    Posts
    9,854
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    sounds like the mysql server is overloaded. and the fact that they "do not have error logging turned on because it would tie up resources" should be a red flag that something is wrong with this host.
    Check out our new Industry News forum!
    Keep up-to-date with the latest SP news in the Community Crier

    I edit the SitePoint Podcast

  5. #5
    SitePoint Member
    Join Date
    Aug 2008
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Red face

    The host is canadawebhosting.com, we've been with them for years, and they have great help staff. This is the first problem I've had. I know they use a shared MySQL server, so you are likely right that it is over loaded somewhat.

    I appear to have solved the problem by breaking the product import down to 200 products at a time. The page then reloads posting a variable which tells it where to pick up the importing again.

    Since this doesn't take very long between requests compared to before it completes without a problem. It does take a little longer overall, but not much.

    I thank you again for your help!!!


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
  •