Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7968143
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:01:50+00:00 2026-06-04T07:01:50+00:00

Im using this tutorial http://papermashup.com/caching-dynamic-php-pages-easily/ for caching a page <?php { $cachefile = $_SERVER[‘DOCUMENT_ROOT’].’cache.html’;

  • 0

Im using this tutorial http://papermashup.com/caching-dynamic-php-pages-easily/ for caching a page

<?php {
$cachefile = $_SERVER['DOCUMENT_ROOT'].'cache.html';
$cachetime = 4 * 60;
// Serve from the cache if it is younger than $cachetime
if (file_exists($cachefile) && time() - $cachetime < filemtime($cachefile)) {
    include($cachefile);
} else {
ob_start(); // Start the output buffer
 ?>

/* Heres where you put your page content */


<?php 
// Cache the contents to a file
$cached = fopen($cacheFile, 'w');
fwrite($cached, ob_get_contents());
fclose($cached);
ob_end_flush(); // Send the output to the browser
}
?>

but i get the following errors

Warning: fopen() [function.fopen]: Filename cannot be empty in

Warning: fwrite(): supplied argument is not a valid stream resource in

Warning: fclose(): supplied argument is not a valid stream resource in

The path to the file is right. And if i edit the file my self is included but again i get the errors

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T07:01:51+00:00Added an answer on June 4, 2026 at 7:01 am

    You have a problem with the casing of your variable name. PHP variable names are case sensitive. Change cacheFile to cachefile (with the small F instead).

    Change this:

    $cached = fopen($cacheFile, 'w');
    

    To this:

    $cached = fopen($cachefile, 'w');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

am using the application in this link http://www.jeasyui.com/tutorial/app/crud2.php .I have added one more column
I followed this tutorial http://mel.melaxis.com/devblog/2005/08/06/localizing-php-web-sites-using-gettext/ where Hello World is translated into German. If I
I'm using CodeIgniter2 + Sparks + PhpActiveRecord, I installed following this tutorial : http://heybigname.com/2011/07/28/codeigniter-2-sparks-php-activerecord-part-1-installation/
Ok, so i created a very simple splash screen using this tutorial: http://p-xr.com/android-tutorial-how-to-make-a-basic-splash-screen/ The
I am using this tutorial to create a login form http://www.ryancoughlin.com/2008/11/04/use-jquery-to-submit-form/ It authenticates against
I'm using a tutorial plugin - http://particlebits.com/code/jquery-tutorial/ which has this code attached to the
I'm following the barcode tutorial for this site: http://brismith66.blogspot.com/2010_07_01_archive.html using the google code: http://code.google.com/p/wsdl2objc/
I am using this code to send mail with php http://www.siteduzero.com/tutoriel-3-35146-e-mail-envoyer-un-e-mail-en-php.html#ss_part_4 . This code
I started using ModX yesterday. Prepared my multilingual website using this tutorial: http://www.multilingual-modx.com/blog/2011/multilingual-websites-with-modx-and-babel.html .
Using this tutorial: http://dotnetslackers.com/articles/ajax/Using-jQuery-with-ASP-NET.aspx The web service is invoked such as Service1.asmx/HelloToYou The default

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.