php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #62079 PHP can't include files after renamed root directory.
Submitted: 2012-05-20 17:38 UTC Modified: 2012-05-21 13:25 UTC
From: sailormax at inbox dot lv Assigned:
Status: Not a bug Package: APC (PECL)
PHP Version: 5.3.13 OS: linux
Private report: No CVE-ID: None
 [2012-05-20 17:38 UTC] sailormax at inbox dot lv
Description:
------------
in my case I renamed phpMyAdmin directory and as result has errors like "Warning: require(sql.php) [function.require]: failed to open stream: No such file or directory in..."

Test script:
---------------
Create files with directory tree:
test1/foo.php: <? include "steps/step2.php" ?>
test1/steps/step2.php: <? require "step3.php" ?>
test1/steps/step3.php: <?="step3.php"?>

Execute from browser: yourhost/test1/foo.php

Rename "test1/" -> "test2/"

Execute from browser: yourhost/test2/foo.php


Expected result:
----------------
output "step3.php

Actual result:
--------------
Warning: require(step3.php) [function.require]: failed to open stream: No such file or directory in /httpdocs/tmp/test1/steps/step2.php on line 2

Fatal error: require() [function.require]: Failed opening required 'step3.php' (include_path='.:') in /httpdocs/tmp/test1/steps/step2.php on line 2




Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-05-20 20:14 UTC] rasmus@php.net
-Status: Open +Status: Not a bug
 [2012-05-20 20:14 UTC] rasmus@php.net
You need to clear your realpath cache if you are going to rename directories from 
underneath a running web server. Call clearstatcache(true) or restart your server 
when you do renames like that.
 [2012-05-21 13:25 UTC] sailormax at inbox dot lv
I do not understand why the reason in this type of cache. Can you explain it?

After renaming I make request to _new file_ in _new path_: test2/foo.php
It contain `include`, which should to be based on directory "test2".
step2.php has `require`, which should to be based on directory "test2/steps" also.

Why it use directory "test1"? I do not see any connections to `stat`-functions, because we should to use _new arguments_ for these functions - the directory, which did no used before => we don't have old cache of that functions.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Aug 05 11:01:23 2021 UTC