If I am not mistaken, this function is not available in PHP4.
Here is a function from php.net, that I had modified to add "if function_exists" which will only define the function if it doesn't exist.
define('FILE_APPEND', 1);
if (!function_exists("file_put_contents")) {
function file_put_contents($n, $d, $flag = false) {
$mode = ($flag == FILE_APPEND || strtoupper($flag) == 'FILE_APPEND') ? 'a' : 'w';
$f = @fopen($n, $mode);
if ($f === false) {
return 0;
} else {
if (is_array($d)) $d = implode($d);
$bytes_written = fwrite($f, $d);
fclose($f);
return $bytes_written;
}
}
}
You can see the original function here.
The "Call to undefined function" usually means that the function does not exist, which is most commonly one of two things:
- The PHP Version you have does not support it (check www.php.net/function_name)
- The function is a user-written and you are missing the function/class/file that where the function exists.
Good Luck!