Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 816913
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T01:54:41+00:00 2026-05-15T01:54:41+00:00

I am working on the development of a web based application on codeigniter. I

  • 0

I am working on the development of a web based application on codeigniter.
I wrote this function to get the timezone data for any city or address.

function gettimezone($address)
    {
       $_url = 'http://api.local.yahoo.com/MapsService/V1/geocode';
        $_url .= sprintf('?appid=%s&location=%s',"phpclasses",rawurlencode($address));
        $_result = false;
        if($_result = file_get_contents($_url)) {
            preg_match('!<Latitude>(.*)</Latitude><Longitude>(.*)</Longitude>!U', $_result, $_match);
            $lng = $_match[2];
            $lat = $_match[1]; 
            $url = "http://ws.geonames.org/timezone?lat={$lat}&lng={$lng}";
            $timedata = file_get_contents($url);
            $sxml = simplexml_load_string($timedata);
            return $sxml->timezone;
        } 
        else
            return false;
    }

I am working on Windows 7 and xampp 1.7 (php 5.2.8).
Is there any possible scenario where this piece of code would crash Apache? The application runs fine almost everytime, but I think running this piece of code when there is no internet connectivity or very poor internet connectivity (thereby no access to either of the webservices I have used) brings down the server. Something like this happened a few times and I think it was due to loss of internet connectivity but I am not sure what exactly is going on.

[ By the way, feel free to use this piece of code. Makes 2 web service calls so don’t use to too often in your application. Consider storing the results in a database.]

Edit: This piece of code and my application works perfectly, almost every time. It just crashed Apache a couple of times a few days ago. And I think its this function is the culprit as this was one of the things that was added just before those crashes.

Edit 2: Here is a small snippet of my apache error log that doesn’t look right. This is there in the log a few times, and I think(quite sure actually) it corresponds to the server crash. Apart from this, there are a few “file does not exist” errors, which won’t crash the server

[Mon May 24 12:14:26 2010] [notice] Parent: child process exited with status 3221225477 -- Restarting.
[Mon May 24 12:15:29 2010] [warn] pid file c:/xampp/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
  • 1 1 Answer
  • 2 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T01:54:41+00:00Added an answer on May 15, 2026 at 1:54 am

    Since there is no Error StackTarace or error log, I suspect the cause of the problem might be:

     $url = "http://ws.geonames.org/timezone?lat={$lat}&lng={$lng}";
    

    Because you are trying to get somedata from another web service, so this might be the problem.

    I would say, put a try/catch around that section like this:

    try
    {
        $url = "http://ws.geonames.org/timezone?lat={$lat}&lng={$lng}";
        $timedata = file_get_contents($url);
        $sxml = simplexml_load_string($timedata);
    }
    catch(Exception $e)
    {
        // log this exception to file
    }
    return $sxml->timezone;
    

    Like you said, it works most of the time. So leave it now and after a week or so, come back and see if the error log contains something interesting for you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently working on a web application development. Our company methodology is to work
Hi i'm a newbie to iphone application development.. present i'm working on Picasa web
I'm working with the ChemAxon JChem cheminformatics application to develop a web-based browsable and
I'm working on my first asp.net/web development application. Obviously, I'm very new to asp.net
I'm working on a web based application, and in order to test my changes,
I'm working on a web-based application using mySQL, and I've used it in the
I am working on a web-based application which is deployed in the Tomcat server.
Let me qualify this question. I'm working on a classic ASP.NET application (Web Forms)
I am continuing the development of an ASP.NET application (web form based) where the
I’m working in a development company, which develops small to medium size web based

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.