SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Wizard
    Join Date
    Jan 2005
    Location
    blahblahblah
    Posts
    1,447
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    strange problem: require_once seems to cache included file

    Hello,

    I'm having a strange problem. I upload a "banner.php" file on my server using FileZilla. This file is included in index.php. No matter what I do, the changes to banner.php are not reflected in index.php. Yet the file seems to be included correctly. When I cut and paste the content of banner.php into index.php instead of including the file, everything works fine.

    It's as if require_once was caching an older version of banner.php and always including it, which, afaik is not possible.

    So I deleted banner.php from my server and completely removed it. But index.php keeps on including it as if it was there. The "old" version, of course.

    What could cause this strange issue? Has anyone seen that before? Could it be some javascript that is causing the problem? Or the use of set_include_path()?

    Thanks in advance.

    -jj.

  2. #2
    SitePoint Zealot 2ndmouse's Avatar
    Join Date
    Jan 2007
    Location
    West London
    Posts
    196
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think you need to provide some example code. However, just a shot in the dark, have you tried using include() rather than require_once()? Does it make any difference?
    Detect file changes remotely. SimpleSiteAudit is an early
    warning anti-hacker system which sends an alert on detection.

    PHP Find Orphan Files - Finds all the unreferenced files on your site.

  3. #3
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Look carefully at the list of folders which stored in your include_path directive.

    It usually looks something like:

    ".;/var/php/PEAR/;/var/includes/"

    ie contains many directories including the dot (present working directory).

    Alternatively use the *nix locate command to find how many instances you have of the include file name "banner.php" -- delete all but the fresh one you uploaded.

    If you are using APC then flush the cache, you never know.
    Last edited by Cups; Dec 31, 2012 at 09:33. Reason: added link to nix man page for locate

  4. #4
    SitePoint Mentor silver trophy
    Rubble's Avatar
    Join Date
    Dec 2005
    Location
    Cambridge, England
    Posts
    2,397
    Mentioned
    81 Post(s)
    Tagged
    3 Thread(s)
    Try clearing your browser cache and/or checking it on another computer?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •