note 109755 added to apc.configuration
| From: | bas_vijfiwinkel | Date: | Fri, 17 Aug 2012 05:36:52 +0000 |
| Subject: | note 109755 added to apc.configuration | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-190108@lists.php.net to get a copy of this message | ||
I took some time to look at the preload_path option.
At the moment of writing the preload_path option is broken because of a bug in the APC source code
which will not allow you to properly preload the cache.
The way to fix it :
Inside 'main_apc.c' in the method called 'static int apc_load_data(const char
*data_file TSRMLS_DC)', the length of the key of the value that needs to be stored is
determined with the following line :
key_len = strlen(key);
If I am correct this is only the length of the string itself without the null-terminator
However, "_apc_store" seems to want the length of the key string including the terminator.
If I change the line above to :
key_len = strlen(key)+1;
then the preload function works as expected.
You can also notice that 1 character is missing when looking at the user cache entries apc.php. But
if you try to use that as a key then APC will not return the contents so that didn't work as a
workaround.
If one is able to compile the apc library from source, then one can of course easily fix this option
by changing the source code.
Files in the specified path should have the extension '.data'.
The filename itself will become the key for the data that is in that specific file.
The data in the file is a serialized string representing what you want to assign to the specific
key. For example s:2:"123" will generate the string "123".
One can only specify 1 value for each key and it should be null-terminated.
It is not possible to preload PHP scripts.
Only values that one retrieved with apc_fetch can be preloaded.
----
Server IP: 69.147.83.197
Probable Submitter: 183.77.249.183
----
Manual Page -- http://www.php.net/manual/en/apc.configuration.php
Edit -- https://master.php.net/note/edit/109755
Del: integrated -- https://master.php.net/note/delete/109755/integrated
Del: useless -- https://master.php.net/note/delete/109755/useless
Del: bad code -- https://master.php.net/note/delete/109755/bad+code
Del: spam -- https://master.php.net/note/delete/109755/spam
Del: non-english -- https://master.php.net/note/delete/109755/non-english
Del: in docs -- https://master.php.net/note/delete/109755/in+docs
Del: other reasons-- https://master.php.net/note/delete/109755
Reject -- https://master.php.net/note/reject/109755
Search -- https://master.php.net/manage/user-notes.php