我无法使apc与High Sierra和PHP 7.1.14一起使用。我做了一切。
以下是php -i |的输出grep apc
PHP Warning: Method apc_store() cannot be a NULL function in Unknown
on line 0
PHP Warning: apc: Unable to register functions, unable to load in
Unknown on line 0
Warning: Method apc_store() cannot be a NULL function in Unknown on
line 0
Warning: apc: Unable to register functions, unable to load in Unknown
on line 0
apcu
apc.coredump_unmap => Off => Off
apc.enable_cli => On => On
apc.enabled => On => On
apc.entries_hint => 4096 => 4096
apc.gc_ttl => 3600 => 3600
apc.mmap_file_mask => no value => no value
apc.preload_path => no value => no value
apc.serializer => php => php
apc.shm_segments => 1 => 1
apc.shm_size => 64M => 64M
apc.slam_defense => On => On
apc.smart => 0 => 0
apc.ttl => 7200 => 7200
apc.use_request_time => On => On
apc.writable => /tmp => /tmp
phpinfo()的输出也显示启用了apcu。
但是当我运行我的应用程序时,会打印出以下错误:
[Fri May 25 18:43:30.523133 2018] [php7:error] [pid 1693] [client
10.146.5.127:54542] PHP Fatal error: Uncaught Error: Call to undefined
function apc_store()
这是将数据添加到apc_store:
的代码段public static function add(LoggedInUser $loggedInUser) {
if (!is_null($loggedInUser) && !is_null($loggedInUser->getUserData()) &&
!is_null($loggedInUser->getUserData()->userId)) {
apc_store($loggedInUser->getUserData()->userId, $loggedInUser, 60);
}
}