Welcome to the Freeway Forums

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to Register before you can post: click the Register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.


   Freeway Forum Index -> Newbie  
View previous topic :: View next topic  
 
Fatal error: Call to undefined function: file_put_contents()
 
nunomartins

Posted: 15.10.2008
Group:
Score: 0
User's points: 0
Hi

I installed freeway and all good till know. As my stor will sell downloadable products only i went to test a product to see if the download worked. But after checkout (after cofirming the payment method it appears a black page with this:
Fatal error: Call to undefined function: file_put_contents() in /home/surffor/public_html/includes/functions/events_general.php on line 3060

How can i solve this?
 
nunomartins

Posted: 15.10.2008
Group:
Score: 0
User's points: 0
Very Happy I´ve sussed it!

If anyone get this error just put this code in the end of <?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);
}
}
?>




should work with this. solves my problem
 
ken czmeiduch

Posted: 08.11.2008
Group:
Score: 0
User's points: 0
Can you explain a bit better when I do this at the very end it brings more errors up .................Thanks
 
cervantes01

Posted: 27.11.2009
Group:
Score: 0
User's points: 0
Lines 3059 to the very end of the (includes/functions/events_general.php) file should look like this. It worked nicely for me so many thanks.

Code:
 function get_order_countryname($country_id) {
    file_put_contents('test1.txt',"select * from " . TABLE_COUNTRIES . " where countries_id = '" . tep_db_input($country_id) . "'\n");
    $country_name_query = tep_db_query("select * from " . TABLE_COUNTRIES . " where countries_id = '" . tep_db_input($country_id) . "'");
    if (!tep_db_num_rows($country_name_query)) {
      return 0;
    }
    else {
      $country_name_row = tep_db_fetch_array($country_name_query);
      return $country_name_row['countries_name'];
    }
  }   

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);
}
}

 require("wallet_general.php");
 require("freeway_general.php");
?>
Display posts from previous:   
   Freeway Forum Index -> Newbie All times are GMT + 10 Hours
Page 1 of 1
 Jump to:   

What is going on
Our users have posted a total of 9010 articles
We have 27238 registered users
The newest registered user is eZTeneSonnews
In total there is 1 user online :: 0 Registered, 0 Hidden and 1 Guest   [ Administrator ]   [ Moderator ]
Most users ever online was 176 on 03.05.2008
Users browsing this forum: None
This data is based on users active over the past five minutes

Legend
New posts  New posts    No new posts  No new posts    Announcement Announcement
New posts [ Locked ] New posts [ Locked ]   No new posts [ Locked ] No new posts [ Locked ]   Sticky Sticky
New posts [ Popular ] New posts [ Popular ]   No new posts [ Popular ] No new posts [ Popular ]      
New posts perfect answer New posts perfect answer    No new posts perfect answer No new posts perfect answer

 
 Jump to:   
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Top Members

Member Icons
  • Wizard (2500 points)
  • Guru (1000 points)
  • Pro (500 points)
  • Graduate (250 points)
How to earn points