Note that there are some explanatory texts on larger screens.

plurals
  1. POApache crashes, probably because of this piece of php code. Can you have a look?
    primarykey
    data
    text
    <p>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.</p> <pre><code>function gettimezone($address) { $_url = 'http://api.local.yahoo.com/MapsService/V1/geocode'; $_url .= sprintf('?appid=%s&amp;location=%s',"phpclasses",rawurlencode($address)); $_result = false; if($_result = file_get_contents($_url)) { preg_match('!&lt;Latitude&gt;(.*)&lt;/Latitude&gt;&lt;Longitude&gt;(.*)&lt;/Longitude&gt;!U', $_result, $_match); $lng = $_match[2]; $lat = $_match[1]; $url = "http://ws.geonames.org/timezone?lat={$lat}&amp;lng={$lng}"; $timedata = file_get_contents($url); $sxml = simplexml_load_string($timedata); return $sxml-&gt;timezone; } else return false; } </code></pre> <p>I am working on Windows 7 and xampp 1.7 (php 5.2.8).<br> 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. </p> <p>[ 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.]</p> <p>Edit: This piece of code and my application works perfectly, <strong>almost every time</strong>. 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. </p> <p>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</p> <pre><code>[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? </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload