icon Get the most out of Surmunity, read our tips here! Need an interesting blog to read? You've got to read the Surpass Blog! | Welcome! Please register to access all of our features.

» Surpass Web Hosting Forums » Discussions » PHP, MySQL » Cannot redeclare file_put_contents() after sh59 upgrade

PHP, MySQL General PHP questions. Or go to our PHPsuexec Forum >>

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread
Old June 5th, 2008, 1:44 AM   #1 (permalink)
Registered User
Seasoned Poster
 
Joined in Feb 2007
74 posts
Gave thanks: 2
Thanked 5 times
Cannot redeclare file_put_contents() after sh59 upgrade

I have a webcam script that contains the following code that was working on surpass sh59 until last night at 2:15 a.m.. I see there was an upgrade notice that said php was being upgraded: SH59 (72.29.74.79): Shared but I'm not sure exactly what changed.

As of 2:15 a.m. the script started returning the error:
PHP Fatal error: Cannot redeclare file_put_contents()

I'm not up to speed with php5 -- can someone give me some help on how the following should be recoded to work with the 5/3/08 php/server upgrade?


if($increment) {
$args['head'] = $head; $args['tail'] = $tail;
$argString = implode_with_keys("\n",$args);
file_put_contents($status_file, $argString, LOCK_EX);
}

$args['max_count'] = $max_count;
return $args;
}

function file_put_contents($n,$d) {
$f=fopen($n,"w");
if (!$f) {
return false;
} else {
fwrite($f,$d);
fclose($f);
return true;
}
}
Island is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old June 5th, 2008, 5:22 AM   #2 (permalink)
mgk
Registered User
Excelling Contributor
 
Joined in Mar 2007
Lives in Wales
Hosted on dime999
620 posts
Gave thanks: 47
Thanked 46 times
It means that the function is already there. You had to put the function in manually in PHP 4 but after the upgrade it is there, and you manual entry is superfluous.
__________________
Markus
mgk is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
This user thanks mgk for this great post!
Island (June 6th, 2008)
Old June 6th, 2008, 3:23 AM   #3 (permalink)
Registered User
Seasoned Poster
 
Joined in Feb 2007
74 posts
Gave thanks: 2
Thanked 5 times
Thanks mgk.
Island is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On