Fatal error: Call to undefined function: file_put_contents()

yngens - October 22, 2006 - 22:06
Project:Fetchgals
Version:4.7.x-1.x-dev
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:closed
Description

I have install 4.7.4 and the module from new. Tried both CVS and 4.7. versions, none works. When going to admin/fetchgals 4.7.4 version gives an error:

Fatal error: Call to undefined function: file_put_contents() in /home/sexez/public_html/modules/fetchgals/fetchgals.module on line 1026

Can you please consult on how to avoid this?

#1

pobster - October 25, 2006 - 07:18

I believe that function only works on php5.0+...

After a quick bit of googling, I found this;

<?php
 
if(!function_exists('file_put_contents')) {
    function
file_put_contents($filename, $data, $file_append = false) {
     
$fp = fopen($filename, (!$file_append ? 'w+' : 'a+'));
        if(!
$fp) {
         
trigger_error('file_put_contents cannot write in file.', E_USER_ERROR);
          return;
        }
     
fputs($fp, $data);
     
fclose($fp);
    }
  }
?>

Just stick in the module right at the bottom and it should fix your problem.

Thanks

Pobster

#2

yngens - October 27, 2006 - 21:12

Thank you, it fixed the problem. I have the module working. But another request if possible. I don't want to go to browse other sites. I thought module makes it possible to view pictures on your own site. I have checked the image directories and they are full of pictures, so why not to make html files to view only those files without going somewhere else. Is it possible?

#3

pobster - October 29, 2006 - 09:54

The module already allows you to do this, if you just go to admin->menu you can enable the 'fetchgals pics' menu item which will allow you to view all your downloaded stuff.

I didn't set it to allow you to view this by default, because I felt that not many people would use it? You'll see why after you use it... The interface is awful... Sorry about that... I've no clue as to how to cache it and so it gets rebuilt *every* time you view a page, this makes it amazingly slow and clunky. Still you can turn off the 'view pictures' in the settings and just have it rebuild text links to make it quicker.

Pobster

#4

pobster - October 30, 2006 - 07:35
Status:active» fixed

#5

Anonymous - November 13, 2006 - 07:45
Status:fixed» closed
 
 

Drupal is a registered trademark of Dries Buytaert.