I am getting a strange error message with the following piece of PHP code (I am not a PHP expert):
if ( $file_loc != NULL ) {
if ( file_exists($file_loc) ) {
printf(" file exists");
$handle = fopen($file_loc, "rb");
$contents = fread($handle, filesize($file_loc));
fclose($handle);
$result = gzdecode($contents);
}
}
I am basically trying to load text content from a gzipped file. I get the following error:
Fatal error: Call to undefined function gzdecode() in ...\sites\MyScripts\fw2.php on line 80
Yet, when I take a look at documentation, it does not seem like I would need to include an extra library, or am I being wrong? How can I solve this issue?
UPDATE
Following another question to check whether this library is installed on my PC, the answer is yes, it is.
From PHP info:
So this is getting more and more confusing...
UPDATE II
I have tried:
<?php
echo phpversion().", ";
if (function_exists("gzdecode")) {
echo "gzdecode OK, ";
} else {
echo "gzdecode no OK, ";
}
if (extension_loaded('zlib')) {
echo "zlib extension loaded ";
} else {
echo "zlib extension not loaded ";
}
?>
and I get:
5.2.17, gzdecode no OK, zlib extension loaded