php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #63367 Able to recognize duplicated files reside on different path
Submitted: 2012-10-26 09:26 UTC Modified: 2013-04-10 14:58 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: howachen at gmail dot com Assigned:
Status: Wont fix Package: APC (PECL)
PHP Version: 5.4.8 OS: Ubuntu
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: howachen at gmail dot com
New email:
PHP Version: OS:

 

 [2012-10-26 09:26 UTC] howachen at gmail dot com
Description:
------------
Now the APC store the md5 of the file if we enabled "apc.file_md5", so why not 
move one step forward - compare the file's md5 hash instead of mtime?

A lot of us reference the same PHP library such as Smarty or Swift Mailer from 
different web sites on the same machine (vhost), this feature can save a lot of 
memory on a busy server.

See: http://serverfault.com/questions/201690/can-apc-recognise-duplicate-source-
files


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-10-26 09:28 UTC] pajoye@php.net
-Status: Open +Status: Feedback
 [2012-10-26 09:28 UTC] pajoye@php.net
Why don't use symlinks then? They are well supported by APC and PHP itself 
(through realpath cache).
 [2013-02-18 00:36 UTC] pecl-dev at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
 [2013-04-10 14:14 UTC] andrew at nicols dot co dot uk
This is something that I've hit before and this solution would solve a lot of 
issues.

When hosting projects of other people's code in a managed hosting solution, you 
may have hundreds of customers running similar 
(but not always exactly the same) code from a selection of projects, it's just 
completely infeasible to manage this with 
symlinks. Additionally, some projects don't handle the use of symlinks 
perfectly.

Taking a quick look at few, popular open source projects:
* WordPress has 492 php files on master
* Mahara has 1250 php files on master
* Symfony has 2235 php files on master
* Moodle has 6429 php files on master

Many of these projects may share the same libraries, but have different versions 
of those libraries between different versions 
of the code. Managing this number of nested symlinks is unrealistic.
 [2013-04-10 14:58 UTC] rasmus@php.net
-Status: No Feedback +Status: Wont fix
 [2013-04-10 14:58 UTC] rasmus@php.net
Doing full-file md5 on every request instead of a simple stat to get the inode 
would be extremely slow. A quick little test written in C (100k iterations) to 
illustrate the difference:

md5 took 79.772855997086 seconds
stat took 0.14313101768494 seconds

So a stat() is 557 times faster than an md5(). For something like APC which is 
all about performance this really isn't feasible.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Jun 22 06:01:23 2021 UTC