Call to undefined function apc_fetch()

Forum for questions and support relating to 1.33.x development only.
Locked
ICXC_Nika
Posts: 14
Joined: Tue May 02, 2017 6:58 pm

Call to undefined function apc_fetch()

Post by ICXC_Nika »

For the past year I have had Ubuntu 16.04 running ZM 1.30.2. Finally getting tired of the ZM Update popups I updated to Ubuntu 18.04.1 LTS and ZM 1.33.1. It ran fine over the weekend and I can view events from the 10 monitors setup but there are several features in the Web UI that are not working for me. This led me to test PHP and I get:

Code: Select all

Fatal error: Uncaught Error: Call to undefined function apc_fetch() in /usr/share/zoneminder/www/api/lib/Cake/Cache/Engine/ApcEngine.php:91 Stack trace: #0 /usr/share/zoneminder/www/api/lib/Cake/Cache/Cache.php(363): ApcEngine->read('myapp_cake_core...') #1 /usr/share/zoneminder/www/api/lib/Cake/I18n/I18n.php(235): Cache::read('cake_dev_en-us', '_cake_core_') #2 /usr/share/zoneminder/www/api/lib/Cake/basics.php(636): I18n::translate('Cache engine "%...', NULL, 'cake_dev') #3 /usr/share/zoneminder/www/api/lib/Cake/Cache/Cache.php(184): __d('cake_dev', 'Cache engine "%...', '_cake_core_') #4 /usr/share/zoneminder/www/api/lib/Cake/Cache/Cache.php(151): Cache::_buildEngine('_cake_core_') #5 /usr/share/zoneminder/www/api/app/Config/core.php(375): Cache::config('_cake_core_', Array) #6 /usr/share/zoneminder/www/api/lib/Cake/Core/Configure.php(72): include('/usr/share/zone...') #7 /usr/share/zoneminder/www/api/lib/Cake/bootstrap.php(442): Configure::bootstrap(true) #8 /usr/share/zoneminder/www/api/app/webroot/index.php(90): incl in /usr/share/zoneminder/www/api/lib/Cake/Cache/Engine/ApcEngine.php on line 91
I have gone through several suggestions within posts here but with my non-existent *nix knowledge, I thought I could use some hand holding on this before I make it worse.

Thank you,
Todd
Thank you,
Todd

ZM 1.33.6
Ubuntu 18.10
iconner package
User avatar
knight-of-ni
Posts: 2404
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: Call to undefined function apc_fetch()

Post by knight-of-ni »

You are either missing the apcu package and/or the apcu_bc package (package names can vary), or apcu cache is not enabled in your php.ini.
Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/
ICXC_Nika
Posts: 14
Joined: Tue May 02, 2017 6:58 pm

Re: Call to undefined function apc_fetch()

Post by ICXC_Nika »

Thank you worthy Knight of Ni! I have both packages so I will look at the ini. If it works I shall bring you a shrubbery.
Thank you,
Todd

ZM 1.33.6
Ubuntu 18.10
iconner package
User avatar
knight-of-ni
Posts: 2404
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: Call to undefined function apc_fetch()

Post by knight-of-ni »

Since you are running Ubuntu, you need to be careful to edit the correct php.ini file. I don't recall which one off the top of head, but it should be in the documentation.
Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/
ICXC_Nika
Posts: 14
Joined: Tue May 02, 2017 6:58 pm

Re: Call to undefined function apc_fetch()

Post by ICXC_Nika »

Thank you! I can only find two php.ini files each for 7.0 and 7.2, none of which make mention of APCU.

I should also mention that the features that do not work in IE, like Add monitor button and rename event, do work in Chrome but Chrome does not show the image.

Code: Select all

find / -type f -name "php.ini"

Code: Select all

/etc/php/7.0/apache2/php.ini
/etc/php/7.0/cli/php.ini
/etc/php/7.2/apache2/php.ini
/etc/php/7.2/cli/php.ini
php-apcu is already the newest version (5.1.9+4.0.11-1build1)
php-apcu-bc is already the newest version (1.0.3-2xenial2)

Is it of consequence that my php-apcu-bc denotes Xenial and my OS is now Bionic?

Which Docs will I be able to find the apcu Cache described?
Thank you,
Todd

ZM 1.33.6
Ubuntu 18.10
iconner package
User avatar
asker
Posts: 1553
Joined: Sun Mar 01, 2015 12:12 pm

Re: Call to undefined function apc_fetch()

Post by asker »

Incidentally, I spent a few hours struggling with apc_fetch() foo when I updated to Ubuntu 18. I installed everything many times and only later realized my CLI PHP was 7.2 but Apache was using 7.0. So I had to do a a2dismod php7.0 and a2enmod php7.2 and voila.
I no longer work on zmNinja, zmeventnotification, pyzm or mlapi. I may respond on occasion based on my available time/interest.

Please read before posting:
How to set up logging properly
How to troubleshoot and report - ES
How to troubleshoot and report - zmNinja
ES docs
zmNinja docs
ICXC_Nika
Posts: 14
Joined: Tue May 02, 2017 6:58 pm

Re: Call to undefined function apc_fetch()

Post by ICXC_Nika »

Thank you Asker! I will take a look at it in the AM.

Todd
Thank you,
Todd

ZM 1.33.6
Ubuntu 18.10
iconner package
ICXC_Nika
Posts: 14
Joined: Tue May 02, 2017 6:58 pm

Re: Call to undefined function apc_fetch()

Post by ICXC_Nika »

Thank you @ASKER - My getVersion.json now returns:

Code: Select all

{
    "version": "1.33.1",
    "apiversion": "1.0"
}
But my ADD and Rename (among other) buttons still are not working. They don't do anything in IE.

Todd
Thank you,
Todd

ZM 1.33.6
Ubuntu 18.10
iconner package
ICXC_Nika
Posts: 14
Joined: Tue May 02, 2017 6:58 pm

Re: Call to undefined function apc_fetch()

Post by ICXC_Nika »

I am still troubleshooting why the 'Add' monitor button doesn't work in IE, it does work in Chrome.

the following error is in the /var/log/apache2.log file:

Code: Select all

PHP7:NOTICE object does not support property or object 'foreach' 
Could these be related?

Todd
Thank you,
Todd

ZM 1.33.6
Ubuntu 18.10
iconner package
ICXC_Nika
Posts: 14
Joined: Tue May 02, 2017 6:58 pm

Re: Call to undefined function apc_fetch()

Post by ICXC_Nika »

I just updated Ubuntu to 18.10 and Zoneminder to 1.33.6 and everything seems to work in IE 11 again.
Thank you,
Todd

ZM 1.33.6
Ubuntu 18.10
iconner package
SpikeyGG
Posts: 60
Joined: Mon Oct 15, 2012 12:02 am

Re: Call to undefined function apc_fetch()

Post by SpikeyGG »

asker wrote: Tue Feb 12, 2019 6:29 pm Incidentally, I spent a few hours struggling with apc_fetch() foo when I updated to Ubuntu 18. I installed everything many times and only later realized my CLI PHP was 7.2 but Apache was using 7.0. So I had to do a a2dismod php7.0 and a2enmod php7.2 and voila.
I was having a similar issue with 1.33.6 on my machine. So I tried a2dismod php7.0 and a2enmod php7.2, and it fixes the api call (I see the version detail when hitting the getVersion.json) but it completely breaks my web interface (goes all white, no warnings no errors).

I can reenable 7.0 and disable 7.2 and the web interface comes back but the api breaks. lol
uiguy
Posts: 6
Joined: Wed Mar 08, 2017 3:29 pm

Re: Call to undefined function apc_fetch()

Post by uiguy »

Hi,

On upgrading to ubuntu 19.04 I am experiencing this problem. I followed the steps outlined above, but came across this:

Code: Select all

root@ZM1:/home/uiguy# find / -type f -name "php.ini"
/etc/php/7.0/apache2/php.ini
/etc/php/7.2/cli/php.ini
/etc/php/7.2/apache2/php.ini
root@ZM1:/home/uiguy# /etc/php/7.2/cli/php.ini
bash: /etc/php/7.2/cli/php.ini: Permission denied
root@ZM1:/home/uiguy# /etc/php/7.2/apache2/php.ini
bash: /etc/php/7.2/apache2/php.ini: Permission denied
root@ZM1:/home/uiguy# a2dismod php7.0
Module php7.0 already disabled
root@ZM1:/home/uiguy# a2enmod php7.2
Considering dependency mpm_prefork for php7.2:
Considering conflict mpm_event for mpm_prefork:
Considering conflict mpm_worker for mpm_prefork:
Module mpm_prefork already enabled
Considering conflict php5 for php7.2:
Module php7.2 already enabled
root@ZM1:/home/uiguy#
Can anyone help?

Thanks
User avatar
burger
Posts: 390
Joined: Mon May 11, 2020 4:32 pm

Re: Call to undefined function apc_fetch()

Post by burger »

uiguy wrote: Wed Jul 31, 2019 9:14 am

Code: Select all

Module php7.0 already disabled
root@ZM1:/home/uiguy# a2enmod php7.2
Considering conflict php5 for php7.2:
Module php7.2 already enabled
root@ZM1:/home/uiguy#
I had this issue on 1.34 today from a Debian/Devuan Jessie to Buster upgrade. However, I got an error message that there was a conflict between php5 and php7. I tried to disable php5, but it wouldn't allow it, so.

Code: Select all

apt-get remove php5*
Which deleted zoneminder and some old php versions...
Then apt-get (re)install zoneminder from zmrepo.zoneminder.com apt repos.

Now API works without issue.
fastest way to test streams:
ffmpeg -i rtsp://<user>:<pass>@<ipaddress>:554/path ./output.mp4 (if terminal only)
ffplay rtsp://<user>:<pass>@<ipaddress>:554/path (gui)
find paths on ispydb or in zm hcl

If you are new to security software, read:
https://wiki.zoneminder.com/Dummies_Guide
Locked