apc

Is APC opcode cache shared between PHP-FPM pools/workers?

吃可爱长大的小学妹 提交于 2021-02-06 08:45:56
问题 Internet has a lot of discussions that calling apc_cache_clear() in CLI does not clear opcode caches from "web" PHP processes, whether they are run inside Apache or by FPM (see How to clear APC cache entries? ). As a suggested solution, it's possible to create a simple PHP page that calls apc_cache_clear() , and call that from CLI. Symfony's ApcBundle does that. If the apc_cache_clear() from CLI does not empty the cache from Apache/FPM, does it between FPM workers? If I call /clear_apc_cache

Cannot use apc_fetch to fetch a stored variable from the cache

我的梦境 提交于 2020-02-05 02:46:07
问题 Environment: PHP: version 7.3 OS: Ubuntu 18.04 References followed: PHP - apc_store PHP - apc_fetch I cannot use apc_fetch from separate PHP script "file2" to access stored cache. It does work when trigger apc_fetch from file1. File: 1_store_variable_in_memory.php <?php $token = "my_token_value"; apc_store('token_1', $token); // var_dump(apc_fetch('token_1')); // Moved to file 2 File: 2_access_memory_stored_variable.php <?php var_dump(apc_fetch('token_1')); Result from file 2: bool(false)

Where does APC store the data?

ぃ、小莉子 提交于 2020-02-03 08:18:07
问题 I want to use apc_store() to cache some results. But I need to know where the data will be stored, and what's the limit. Does it always store on memory? Or also writes to disk? I would prefer that the data that is not accessed very frequently is stored on disk. Should I use a different caching system for that? Is this the limit? apc.shm_size = 32MB . If so, what happens when I exceed it? 回答1: Data stored in the APC variable cache via apc_store() is always stored in memory. If you need to

PHP: APC enabled, but still doesn't work?

感情迁移 提交于 2020-02-03 04:48:05
问题 On my new Xubuntubox I installed the lamp-server tools, php , php-apc , added the extension=apc.so line to the php.ini and rebootet the system. Apache and PHP seem to work well, but APC doesn't. So I checked what the apc.php file would say: No cache info available. APC does not appear to be running. But in the php info it seems to be enabled. Have a look what php -i | grep 'apc' says: Additional .ini files parsed => /etc/php5/cli/conf.d/apc.ini, apc apc.cache_by_default => On => On apc

APC机制详解

僤鯓⒐⒋嵵緔 提交于 2020-02-01 19:12:45
文章目录 APC的本质 APC队列 APC结构 APC相关函数 KiServiceExit KiDeliveApc 备用APC队列 ApcState的含义 挂靠环境下的ApcState的含义 其他APC相关成员 ApcStatePointer ApcStateIndex ApcStatePointer与ApcStateIndex组合寻址 ApcQueueable APC挂入过程 KAPC结构 挂入流程 KeInitializeApc ApcStateIndex KiInsertQueueApc 内核APC的执行过程 执行点:线程切换 执行点:系统调用 中断或者异常(_KiServiceExit) KiDeliverApc函数的执行流程 总结 用户APC的执行过程 执行用户APC时的堆栈操作 KiInitializeUserApc函数分析:备份CONTEXT KiInitializeUserApc函数分析:堆栈图 KiInitializeUserApc函数分析:准备用户层执行环境 总结 KiInitializeUserApc函数分析:准备用户层执行环境 总结 APC的本质 线程是不能被杀死 挂起和恢复的,线程在执行的时候自己占据着CPU,别人怎么可能控制他呢?举个极端的例子,如果不调用API,屏蔽中断,并保证代码不出现异常,线程将永久占据CPU。所以说线程如果想结束

Cannot instantiate abstract class … in appDevDebugProjectContainer.php - Symfony2

最后都变了- 提交于 2020-02-01 05:31:21
问题 I have just installed yesterday apc and I am now getting this error: FatalErrorException: Error: Cannot instantiate abstract class ACME\WebBundle\Menu\MenuBuilder in /var/www/app/cache/dev/appDevDebugProjectContainer.php line 743 and in that line there is: protected function getEposMain_MenuBuilderService() { return $this->services['epos_main.menu_builder'] = new \ACME\WebBundle\Menu\MenuBuilder($this->get('knp_menu.factory')); } Does any one know what does it mean and what I can do with it?

PHP OPCode缓存:APC详细介绍

折月煮酒 提交于 2020-01-26 01:10:17
前言 PHP语言在性能上相对于其他编译型语言来说性能算不上突出,但是使用了OPCode缓存后性能提升还是很明显的.常见的主要有 Eaccelerator,XCache,APC本文主要介绍APC的使用. APC的介绍 The Alternative PHP Cache (APC) is a free and open opcode cache for PHP. Its goal is to provide a free, open, and robust framework for caching and optimizing PHP intermediate code. APC官方网站: http://www.php.net/manual/en/book.apc.php WIN下最新版本的下载地址: http://downloads.php.net/pierre/ 下载连接: http://downloads.php.net/pierre/php_apc-3.1.4-5.3-VC6-x86.zip 根据自己的PHP编译版本使用相对应的DLL APC配置 APC配置主要讲解在WIN下的配置,类linux下的配置网上文章比较多 1.下载php_apc.dll 到PHP的ext目录下 2.修改php.ini 添加extension=php_apc.dll 在php.ini尾部添加配置项

delete cache by prefix in apc / memcache / eaccelerator

被刻印的时光 ゝ 提交于 2020-01-23 01:13:08
问题 Let's assume I have these variables saved in apc, memcached and eaccelerator: article_1_0 article_1_1 article_3_2 article_3_3 article_2_4 How can I delete all cached variables that starts with article_3_ (they can reach up to 10000) ? is there any way to list the cached variables ? 回答1: The slow solution For APC: $iterator = new APCIterator('user', '#^article_3_#', APC_ITER_KEY); foreach($iterator as $entry_name) { apc_delete($entry_name); } For eaccelerator: foreach(eaccelerator_list_keys()

Windows APC学习笔记(一)—— APC的本质&备用APC队列

你。 提交于 2020-01-12 18:00:28
Windows APC学习笔记(一)—— APC的本质&备用APC队列 前言 基础知识 APC的本质 APC队列 APC结构 分析 KiServiceExit 总结 备用APC队列 挂靠环境下ApcState的意义 ApcStatePointer ApcStateIndex 组合寻址 ApcQueueable 前言 一、学习自 滴水编程达人 中级班课程, 官网:https://bcdaren.com 二、海东老师牛逼! 基础知识 线程是不能被“ 杀掉 ”、“ 挂起 ”、“ 恢复 ”的,线程在执行的时候自己占据着CPU,别人怎么可能控制它呢? 举个极端的例子:如果 不调用API , 屏蔽中断 , 并保证代码不出现异常 ,线程将 永久 占用CPU,何谈控制呢? 所以说线程如果想“死”,一定是自己执行代码把自己杀死,不存在“他杀”的情况 思考 :那如果想改变一个线程的行为该怎么办呢? 答案 :可以给他提供一个函数,让它自己去调用: APC(Asyncroneus Procedure Call,异步过程调用) APC的本质 APC队列 在Windbg中查看 : ApcListHead : 由两个双向链表组成,共占16个字节 提供的APC函数可能是 用户函数 ,也可能是 系统函数 (简单的区分方法就是判断函数地址是否大于 0x80000000 ) Process :指向线程所属或者挂靠进程

how to get php cli processes share variables via apc

▼魔方 西西 提交于 2020-01-07 05:43:06
问题 i have apc.enable_cli=1 in php.ini for cli; i tested sharing variables with apc with this script: <?php $apctest=apc_fetch('apctest'); echo "apctest was " . $apctest; echo "\n"; if($argc>1){ $newval=$argv[1]; }else{ $newval='ok'; } echo "setting apctest to " . $newval; echo "\n"; apc_store('apctest',$newval); sleep(30); i runned it with php test_cli_apc.php > /dev/null & and then within 30 seconds runned php test_cli_apc.php but it has outputted "apctest was " , not "apctest was ok" i have