WordPress + Phoogle + Dreamhost, Problems and Solutions.

general 5 January 2007 | View Comments

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[/tags]

Bookmark and Share

Tagged in

View Comments on “WordPress + Phoogle + Dreamhost, Problems and Solutions.”

  1. Bruno says:

    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.

  2. Josh says:

    Thank you so much for this. Worked perfectly!

  3. Typolight says:

    Thanks, you nice post that helped me alot.

  4. Jason says:

    Passed, senks author

  5. queroeropoo says:

    Good information to me.

  6. penisenlargementdevice says:

    SizeGenetics is a medical penis enlargement device that effectively and safely works to increase penis size. If you want the best penis enlargement product at http://www.AmericanExtender.com

Trackbacks/Pingbacks

  1. [...] Check out Alex’s blog post about Using Phoogle on Dreamhost  [...]

  2. [...] Eventually, after much wailing and gnashing of teeth, Google ‘fessed up this link to Alex Hillman’s Development blog, dangerouslyawesome. [...]

  3. [...] y no puedo utilizar la función file_get_contents(). Pues bien, navegando por Internet descubrí este recurso que explica exactamente cómo se resuelve este problema: para que Phoogle funcione en un PHP [...]

Leave a Reply

blog comments powered by Disqus