Bonjour à tous.
Je suis en train d’installer squidfire, j’ai cependant un pb: voilà ce que j’obtient quand je lance dans “iceweasel”
quote Fatal error: Function name must be a string in /proxy/log/squidfire-1.3.0/cache.inc.php on line 154
Call Stack
Time Memory Function Location
1 0.0000 53476 {main}( ) …/index.php:0
2 0.0029 64324 get_log_cache( ) …/index.php:92
3 0.0048 66252 create_log_cache( ) …/cache.inc.php:37
4 0.0048 66772 get_start_date( ) …/cache.inc.php:71[/quote]
Ci joint le fichier en question “/proxy/log/squidfire-1.3.0/cache.inc.php”
[quote]<?php
// If the modificaiton times don’t match then grab the first and last record of
// the log to figure out the date range it reports on. Else just include the cache file.
// Now we look at the first 5 records in case there is some junk at the top or bottom of
// the log file.
function get_log_cache($logpath, $logfile){
global $cachepath;
global $cacheversion;
global $error;
$log_md5 = ‘’;
set_time_limit(120);
// If the log isn't readable, don't want to display the From/To info
if ( is_readable($logpath.$logfile) ){
// Get a MD5 signature based on the last 10k bytes of the log file.
$log_tail = `/usr/bin/tail -c 10240 $logpath$logfile`;
$log_md5 = md5($log_tail);
}else{
$error .= "<li>Log file isn't readable.";
$error .= " <ol>\n";
$error .= " <li>Check that [<span>".$logpath.$logfile.'.inc'."</span>] is readable by the user [<span>".trim(`whoami`)."</span>]</li>\n";
$error .= " </ol>\n";
$error .= "</li>\n";
}
// Include the cached log information if it exists.
if (file_exists($cachepath.$logfile.'_'.$cacheversion.'.inc')){
include($cachepath.$logfile.'_'.$cacheversion.'.inc');
}else{
$cache_md5 = 'unknown';
}
// If the cached log information doesn't match the current log then re-build the cache.
if ($log_md5 <> $cache_md5){
create_log_cache($logpath, $logfile, $log_md5, $error);
if ( (file_exists($cachepath.$logfile.'_'.$cacheversion.'.inc')) AND (is_readable($cachepath.$logfile.'_'.$cacheversion.'.inc')) ){
include($cachepath.$logfile.'_'.$cacheversion.'.inc');
}else{
$error .= "<li>Cache file isn't readable.";
$error .= " <ol>\n";
$error .= " <li>Check that [<span>".$cachepath.$logfile.'_'.$cacheversion.'.inc'."</span>] is readable by the user [<span>".trim(`whoami`)."</span>]</li>\n";
$error .= " </ol>\n";
$error .= "</li>\n";
}
}
echo " <tr>\n";
echo " <td class=\"loglist\">\n";
echo " $cache_from\n";
echo " </td>\n";
echo " <td class=\"loglist\">\n";
echo " $cache_to\n";
echo " </td>\n";
echo " <td align=right>\n";
echo " ".number_format($cache_totalrows, 0)."\n";
echo " </td>\n";
echo " <td class=\"loglist\">\n";
echo " <a href=".$_SERVER["PHP_SELF"]."?log=".urlencode($logfile).">$logfile</a>\n";
echo " </td>\n";
echo " </tr>\n";
}
function create_log_cache($logpath, $logfile, $log_md5, &$error){
global $cachepath;
global $cacheversion;
$logcache = ‘’;
$from = get_start_date($logpath.$logfile, $error);
$to = get_end_date($logpath.$logfile, $error);
$totalrows = get_total_rows($logpath.$logfile, $error);
if ( (strtolower($to) <> "unknown") AND (strtolower($from) <> "unknown") ){
if (is_writable($cachepath)){
touch($cachepath.$logfile.'_'.$cacheversion.'.inc');
if (is_writable($cachepath.$logfile.'_'.$cacheversion.'.inc')){
if (!$fhandle = fopen($cachepath.$logfile.'_'.$cacheversion.'.inc', 'w')) {
$error .= "<li>Couldn't open cache file in write mode.";
$error .= " <ol>\n";
$error .= " <li>Check that [<span>".$cachepath.$logfile.'_'.$cacheversion.'.inc'."</span>] is writeable by the user [<span>".trim(`whoami`)."</span>]</li>\n";
$error .= " </ol>\n";
$error .= "</li>\n";
}else{
$logcache .= "<?php\n";
$logcache .= " \$cache_from = '$from';\n";
$logcache .= " \$cache_to = '$to';\n";
$logcache .= " \$cache_md5 = '$log_md5';\n";
$logcache .= " \$cache_totalrows = '$totalrows';\n";
$logcache .= "?>";
if (!fwrite($fhandle, $logcache)) {
$error .= "<li>Couldn't write data to cache file [".$cachepath.$logfile.'_'.$cacheversion.'.inc'."</span>]\n";
$error .= " <ol>\n";
$error .= " <li>Check that the disk is not full</li>\n";
$error .= " <li>Check that [<span>".$cachepath.$logpath.'_'.$cacheversion.'.inc'."</span>] is writeable by the user [<span>".trim(`whoami`)."</span>]</li>\n";
$error .= " </ol>\n";
$error .= "</li>\n";
fclose($fhandle);
}else{
fclose($fhandle);
}
}
}else{
$error .= "<li>Couldn't open cache file in write mode.";
$error .= " <ol>\n";
$error .= " <li>Check that [<span>".$cachepath.$logfile.'_'.$cacheversion.'.inc'."</span>] is writeable by the user [<span>".trim(`whoami`)."</span>]</li>\n";
$error .= " </ol>\n";
$error .= "</li>\n";
}
}else{
$error .= "<li>Cache path isn't writeable.";
$error .= " <ol>\n";
$error .= " <li>Check that [<span>$cachepath</span>] is writeable by the user [<span>".trim(`whoami`)."</span>]</li>\n";
$error .= " </ol>\n";
$error .= "</li>\n";
}
}
}
function get_start_date($logpath,&$error){
global $dateformat;
if ( !is_readable($logpath)){
$error .= "<li>Log file isn't readable.";
$error .= " <ol>\n";
$error .= " <li>Check that [<span>$logpath</span>] is readable by the user [<span>".trim(`whoami`)."</span>]</li>\n";
$error .= " </ol>\n";
$error .= "</li>\n";
}else{
if (strtolower(substr($logpath, strlen($logpath)-3, 3)) == ".gz"){
if (function_exists("gzopen")){
$loghandle = gzopen($logpath, "r");
$readfunction = "gzgets";
$closefunction = "gzclose";
}else{
$error .= "<li>Unable to open compressed log file.\n";
$error .= " <ol>\n";
$error .= " <li>Unable to open [".$logpath.$log."] because PHP was not compiled with the --with-zlib option.</li>";
$error .= " </ol>\n";
$error .= "</li>\n";
}
}else{
$loghandle = fopen($logpath, "r");
$readfunction = "fgets";
$closefunction = "fclose";
}
}
$from = '';
for ($y=0;$y<5;$y++){
if ($from == ''){
$rawrow = $readfunction($loghandle, 10240);
$row = parse_log_row($rawrow);
$from = $row['date'];
if (date('Y', $from) < 1971){
$from = '';
}
}
}
$closefunction($loghandle);
if ($from == ''){
$from = "Unknown";
}else{
$from = date($dateformat, $from);
}
return $from;
}
function get_end_date($logpath, &$error){
global $dateformat;
if ( !is_readable($logpath)){
$error .= "<li>Log file isn't readable.";
$error .= " <ol>\n";
$error .= " <li>Check that [<span>$logpath</span>] is readable by the user [<span>".trim(`whoami`)."</span>]</li>\n";
$error .= " </ol>\n";
$error .= "</li>\n";
}else{
if (strtolower(substr($logpath, strlen($logpath)-3, 3)) == ".gz"){
exec("gzip -c -d $logpath |tail -n 5", $s3);
}else{
exec("/usr/bin/tail -n 5 ".$logpath, $s3);
}
}
$to = '';
for ($y=count($s3)-1;$y>-1;$y--){
if ($to == ''){
$row = parse_log_row($s3[$y]);
$to = $row['date'];
if (date('Y', $to) < 1971){
$to = '';
}
}
}
if ($to == ''){
$to = "Unknown";
}else{
$to = date($dateformat, $to);
}
return $to;
}
function get_total_rows($logpath, &$error){
$totalrows = 0;
if ( !is_readable($logpath)){
$error .= "<li>Log file isn't readable.";
$error .= " <ol>\n";
$error .= " <li>Check that [<span>$logpath</span>] is readable by the user [<span>".trim(`whoami`)."</span>]</li>\n";
$error .= " </ol>\n";
$error .= "</li>\n";
}else{
if (strtolower(substr($logpath, strlen($logpath)-3, 3)) == ".gz"){
$totalrows = rtrim(`gzip -c -d $logpath |wc -l`);
}else{
$totalrows = rtrim(`cat $logpath |wc -l`);
}
}
return $totalrows;
}
?>[/quote]
Quelqu’un pourrait il maider because je ne comprends rien en PHP?