Forum Moderators: coopster
I'm in the process of updating my site with a new database and php file that drives it. The guy who does my php/db work is unreachable so i cant get him to help. I'm coming up with this:
Fatal error: Call to undefined function: file_get_contents() in /usr/local/mydomainname.com/public/functions.php on line 16
Would it be that my host has an older version of php installed that cant recognise this function?
thanks for any help
you can write the function on your own and put it to your script, so you won't get anymore errors with your php version. if you upgrade later on, you can simly delete that function, you main script will continue to work with no problems:
function file_get_contents($filename, $use_include_path=0) {
/* reads out the complete contents of $filename */
$handle = fopen ($filename, "r",$use_include_path);
$contents = fread ($handle, filesize ($filename));
fclose ($handle);
return $contents;
}
you can use this function then as described in the php manual.
-hakre
if(!function_exists('file_get_contents') ) {
function file_get_contents($filename, $use_include_path=0) {
/* reads out the complete contents of $filename */
$handle = fopen ($filename, "r",$use_include_path);
$contents = fread ($handle, filesize ($filename));
fclose ($handle);
return $contents;
}
}
This way if it's not there it will be created. If you upgrade PHP then you *SHOULD* remember to take it out but atleast your site will not break.
Though I would sugest to upgrade you PHP if at all possible since there were quite a few security patches that were fixed in 4.3.1.
daisho.
Warning: stat failed for [madeupdomain.com...] (errno=2 - No such file or directory) in /user/local/home/vhosts/mydomain.com/public/mydirectory/functions.php on line 10
Anyone interested in some work?