I am trying to run
app/console doctrine:schema:create --dump-sql
using Symfony 2.7 on Ubuntu 16.04 with PHP7. The above command throws the following error:
[Symfony\Component\Debug\Exception\UndefinedFunctionException]
Attempted to call function "apc_fetch" from namespace "Doctrine\Common\Cache".
The following post do list similar issues - without a working solution (from my point of view)
I have php-apcu
installed, php -m
outputs:
[PHP Modules]
apcu
calendar
Core
ctype
date
dom
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
json
libxml
mbstring
mcrypt
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
Phar
posix
readline
Reflection
session
shmop
SimpleXML
sockets
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zlib
[Zend Modules]
Zend OPcache
The output of php -r 'phpinfo();' |grep apc
is:
/etc/php/7.0/cli/conf.d/20-apcu.ini,
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 => 32M => 32M
apc.slam_defense => On => On
apc.smart => 0 => 0
apc.ttl => 0 => 0
apc.use_request_time => On => On
apc.writable => /tmp => /tmp
So my conclusion is - the APCU module is loaded but i still get the UndefinedFunctionException.
Help is appreciated
apc_fetch() is a function in the now deprecated apc module. To use it with apcu on php7, use pecl to install the apcu_bc package.
http://pecl.php.net/package/apcu_bc
Additionally, add the line
extension=apc.so
to your php.ini (or your apcu.ini). This will provide backward compatibility with the apc module.