Doctrine undefined function apc_fetch

2019-04-04 07:45发布

I'm using this tutorial, which gives a detail explanation about how to set up CodeIgniter and Doctrine. I'm using CodeIgniter 2.1.0 and Doctrine 2.2.1, but I get this error:

Fatal error: Call to undefined function Doctrine\Common\Cache\apc_fetch() in /Applications/XAMPP/xamppfiles/htdocs/emma_watson_shrine/application/libraries/Doctrine/Common/Cache/ApcCache.php on line 52

Can you help me out?

6条回答
老娘就宠你
2楼-- · 2019-04-04 08:21

You need to enable the APC extension for PHP.

Follow this guide.

Alternatively, you could use a different caching driver, like memcache, and change the Doctrine config in accordance to that.

Check the doctrine documentation for alternate caching drivers. Perhaps the simplest solution would be to use ArrayCache in development.

查看更多
兄弟一词,经得起流年.
3楼-- · 2019-04-04 08:27

Since php 5.5 apc is no longer used. You should install apcu.

E.g.

apt install php5.6-apcu

More info here:

http://php.net/manual/en/opcache.installation.php

And for those on php 7 there's a backwards compatibility module:

apt-get install php7.0-apcu
apt-get install php7.0-apcu-bc

Also, you might need to add this repository:

apt-add-repository ppa:ondrej/php
apt-get update
查看更多
Summer. ? 凉城
4楼-- · 2019-04-04 08:32

you need to install apc extension to work with caching. So just download the extension and install it.

This one will help you to install APC extension on apache.

http://kvcodes.com/2014/06/solution-call-undefined-function-apc_fetch/

查看更多
一夜七次
5楼-- · 2019-04-04 08:34

For anyone getting this on a Mac, just install apcu using Homebrew:

brew install php56-apcu

(and enable the extension, if required).

查看更多
我只想做你的唯一
6楼-- · 2019-04-04 08:41

If you don't install APC and just want to run it then in doctrine-cli.php at line 6, change mode:

define('ENVIRONMENT', 'production');

to

define('ENVIRONMENT', 'development');

Open Doctrine.php file, at line 36 ~ 43, you will see why!

查看更多
beautiful°
7楼-- · 2019-04-04 08:42

On OSX I had to run:

pecl channel-update pecl.php.net
pecl install apcu-4.0.11

to install for PHP 5.6

https://getgrav.org/blog/macos-mojave-apache-mysql-vhost-apc

查看更多
登录 后发表回答