Dreamhost and File Get

If you're having problems with your PHP scripts in Dreamhost, it's probably the File Get command.

[an error occurred while processing this directive]

You'll need to use curl, so create this function:

// function to replace file_get_contents()
function file_get_the_contents($url) {
$ch = curl_init();
$timeout = 10; // set to zero for no timeout
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$file_contents = curl_exec($ch);
return $file_contents;

Then, whenever you see a line that looks something like:


Change file_get_contents to file_get_the_contents.

Please take note that there's an http:// after file_get_contents. If your PHP code does not show the http, then please leave the file_get_contents as-is.

I hope that solves your PHP script problems in Dreamhost.

[ First posted on 04/30/2008 by Manuel Viloria ]

Do you LIKE this page? Please let us know, and we will publish more of the content that YOU want. Salamat po!

Panuorin Mo Ito...

Visit SupremeWealthAlliance.net ~ Kumita sa Internet, Kahit Super-BUSY Ka

Get In Touch With Manuel Today

  Previous Entry
  Next Entry

Secondthoughts @ Viloria.com
Manuel Viloria

About Manuel Viloria
Contact Us
Privacy Statement
RSS Feed

Google Reader

Copyright © 1996 - 2012 by Viloria.com All Rights Reserved.