Wordpress + Phoogle + Dreamhost, Problems and Solutions.
I’m currently building a brochureware site based on my buddy’s wordpress-come-CMS which he has dubbed “Redstart”. The beauty of building a site on top of wordpress‘ architecture is that all of the cool handy plugins that have been written for bloggers are now at your disposal!
So this particular site is calling for a google maps implimentation. Not that this is difficult by any stretch, but having a plugin pre-built to allow easy management from the wordpress console would be handy. Enter Phoogle. Phoogle allowed for next to instantaneous setup of a google maps implimentation. Simply provide it with an API key, make a few calls with the desired locations to map, and it does the rest. Worked beautifully.
The problem arose when I went to move to my staging server. I was receiving “file_get_contents” errors, with reference to my server configuration. Luckily, my host Dreamhost has a pretty handy wiki for these types of problems. This article turned up my solution:
The line
$addressData = file_get_contents($apiURL.urlencode($address));
needed to be replaced by this convoluted piece of crud,
$ch = curl_init();
$timeout = 0; // set to zero for no timeout
curl_setopt ($ch, CURLOPT_URL, $apiURL.urlencode($address));
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$addressData = curl_exec ($ch);
/**Note the added space between the function and the left parens. this will need to be removed in production**/
curl_close($ch);
Why, you might ask, well the wiki says the following:
In a measure to improve security, DreamHost has disabled the PHP option allow_url_fopen. This would normally allow a programmer to open, include or otherwise use a remote file using a URL, rather than a local file path. The cURL library provides a feature-rich alternative.
So it’s not totally pointless, but it does mean that the cURL solution (7 lines instead of 1) provides a more robust solution.
Hopefully this helps someone else.
Tags: wordpress, redstart, concept64, dreamhost, phoogle, gmaps, google maps, debugging

27. January 2007 at 12:14
[...] Check out Alex’s blog post about Using Phoogle on Dreamhost [...]
21. March 2007 at 12:04
Alex,
I recently discovered Phoogle and it did save me some time, but as yourself, I also use Dreamhost as my test server and of course, came across the same file_get_contents problem.
Just wanted to let you know that this solution came as a blessing after trying to resolve this issue in a different way.
Keep up the good work :-)
Thanks,
Bruno.
16. May 2007 at 16:21
Thank you so much for this. Worked perfectly!
12. September 2007 at 22:58
[...] Eventually, after much wailing and gnashing of teeth, Google ‘fessed up this link to Alex Hillman’s Development blog, dangerouslyawesome. [...]