RHEL6 PHP curl fails if network started after apache starts

Latest response

I do development on my RHEL6 laptop with a wireless device. The wireless network does not start until I log into the GDM session. This means apache starts before the network starts. Anyway, I find that PHP curl calls do not work unless apache is restarted. The curl requests fail to do work due to inability of curl to resolve hostnames. This simple request will fail unless apache is restarted:

<?php

$ch = curl_init("http://www.redhat.com/");
$fp = fopen("index.html", "w");

curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, 0);

$response = curl_exec($ch);
if ($response === false) { echo 'failed!'; }
curl_close($ch);
fclose($fp);
?>

Anybody have ideas on this?

Responses