1.30.2 upgrade breaks API access

Forum for questions and support relating to the 1.30.x releases only.
rkaule
Posts: 11
Joined: Wed Apr 19, 2017 2:08 pm
Location: Pittsburgh, PA

Re: 1.30.2 upgrade breaks API access

Post by rkaule »

apbb2 wrote:
bbunge wrote:
rkaule wrote:Hi all,

I had the above problem. I would get a blank page back when trying to access the api page. I did the fix above (systemd-tmpfiles --create zoneminder.conf) and now I get a red bar that states :

Error: The requested address '/zm/api/' was not found on this server.

Thanks,
Bob
Assume you have Ubuntu but which version.
I'm running 14.04.5 & have the same issue.

The fix above fixed my issue but have the /zm/api error. It's working so its fixed but not errorless.

I can get to the site with zmNinja now (which it wasn't doing yesterday). Everything seems to be working in ZM and zmNinja, but when I try to access the api page I still get the error.
rockedge
Posts: 1173
Joined: Fri Apr 04, 2014 1:46 pm
Location: Connecticut,USA

Re: 1.30.2 upgrade breaks API access

Post by rockedge »

are the URL rewrites working correctly? I have found that a lot of these problems in this thread can be caused by mis-functioning url rewrites from ]/usr/share/zoneminder/www/api/.htaccess and /usr/share/zoneminder/www/api/app/.htaccess
User avatar
knight-of-ni
Posts: 2404
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: 1.30.2 upgrade breaks API access

Post by knight-of-ni »

rkaule wrote: Fri Apr 21, 2017 9:02 pm
apbb2 wrote:
bbunge wrote: Assume you have Ubuntu but which version.
I'm running 14.04.5 & have the same issue.

The fix above fixed my issue but have the /zm/api error. It's working so its fixed but not errorless.

I can get to the site with zmNinja now (which it wasn't doing yesterday). Everything seems to be working in ZM and zmNinja, but when I try to access the api page I still get the error.
Working as intended. Cake debug mode was turned off by default in 1.30.2 because it was discovered an attacker could easily get it to reveal sensitive information when debug is turned on. When debug is turned off, the /zm/api url will not work. This is by design of the cakephp project. The actual meat of the API will continue to function normally.
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/
gdl
Posts: 3
Joined: Wed May 03, 2017 12:20 pm

Re: 1.30.2 upgrade breaks API access

Post by gdl »

I'm also facing API issues with 1.30.3, I'm on Ubuntu 16.04.2 LTS. When accessing https://<server>/zm/api/host/getVersion.json I get an empty page, and the Apache error log shows:

Code: Select all

[Wed May 03 13:12:46.485093 2017] [:error] [pid 4496] [client **.**.**.**:63354] PHP Warning:  include(Cake/bootstrap.php): failed to open stream: No such file or directory in /usr/share/zoneminder/www/api/app/webroot/index.php on line 90
[Wed May 03 13:12:46.485136 2017] [:error] [pid 4496] [client **.**.**.**:63354] PHP Warning:  include(): Failed opening 'Cake/bootstrap.php' for inclusion (include_path='/usr/share/zoneminder/www/api/lib:.:/usr/share/php') in /usr/share/zoneminder/www/api/app/webroot/index.php on line 90
[Wed May 03 13:12:46.485161 2017] [:error] [pid 4496] [client **.**.**.**:63354] PHP Fatal error:  CakePHP core could not be found. Check the value of CAKE_CORE_INCLUDE_PATH in APP/webroot/index.php. It should point to the directory containing your /cake core directory and your /vendors root directory. in /usr/share/zoneminder/www/api/app/webroot/index.php on line 99
Any clues?
bbunge
Posts: 2930
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: 1.30.2 upgrade breaks API access

Post by bbunge »

gdl wrote: Wed May 03, 2017 12:27 pm I'm also facing API issues with 1.30.3, I'm on Ubuntu 16.04.2 LTS. When accessing https://<server>/zm/api/host/getVersion.json I get an empty page, and the Apache error log shows:

Code: Select all

[Wed May 03 13:12:46.485093 2017] [:error] [pid 4496] [client **.**.**.**:63354] PHP Warning:  include(Cake/bootstrap.php): failed to open stream: No such file or directory in /usr/share/zoneminder/www/api/app/webroot/index.php on line 90
[Wed May 03 13:12:46.485136 2017] [:error] [pid 4496] [client **.**.**.**:63354] PHP Warning:  include(): Failed opening 'Cake/bootstrap.php' for inclusion (include_path='/usr/share/zoneminder/www/api/lib:.:/usr/share/php') in /usr/share/zoneminder/www/api/app/webroot/index.php on line 90
[Wed May 03 13:12:46.485161 2017] [:error] [pid 4496] [client **.**.**.**:63354] PHP Fatal error:  CakePHP core could not be found. Check the value of CAKE_CORE_INCLUDE_PATH in APP/webroot/index.php. It should point to the directory containing your /cake core directory and your /vendors root directory. in /usr/share/zoneminder/www/api/app/webroot/index.php on line 99
Any clues?
working on it. Likely a dependency is missing. Possibly php7-apcu
ios77
Posts: 2
Joined: Wed May 03, 2017 2:24 pm

Re: 1.30.2 upgrade breaks API access

Post by ios77 »

Same error here after upgrading to 1.30.3:

Code: Select all

[Wed May 03 16:20:58.124863 2017] [:error] [pid 1038] [client:62030] PHP Warning:  include(Cake/bootstrap.php): failed to open stream: No such file or directory in /usr/sh
are/zoneminder/www/api/app/webroot/index.php on line 90
[Wed May 03 16:20:58.124905 2017] [:error] [pid 1038] [client :62030] PHP Warning:  include(): Failed opening 'Cake/bootstrap.php' for inclusion (include_path='/usr/share/z
oneminder/www/api/lib:.:/usr/share/php') in /usr/share/zoneminder/www/api/app/webroot/index.php on line 90

any help?
thanks
bbunge
Posts: 2930
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: 1.30.2 upgrade breaks API access

Post by bbunge »

There was an updated version of the 1.30.3 package released this morning about 1000 EDT. Testing it now.

For 16.04 you should be able to install php-apcu and restart Apache to get the API to work.
Mozart
Posts: 17
Joined: Fri Aug 26, 2016 8:41 am

Re: 1.30.2 upgrade breaks API access

Post by Mozart »

bbunge wrote: Wed May 03, 2017 2:54 pm There was an updated version of the 1.30.3 package released this morning about 1000 EDT. Testing it now.

For 16.04 you should be able to install php-apcu and restart Apache to get the API to work.
I am on 16.04 and did install php-apcu but still get the errors about Cake/bootstrap.php like the user ios77 reports above.
And I did a reinstall of zoneminder but it does not help. Zoneminder works fine with the exception of the API.
When accessing https://<server>/zm/api/host/getVersion.json I get an error 500.
gdl
Posts: 3
Joined: Wed May 03, 2017 12:20 pm

Re: 1.30.2 upgrade breaks API access

Post by gdl »

I can confirm that the latest update package did not resolve the issue. It looks to me like the file bootstrap.php is missing in the Cake folder.
gdl
Posts: 3
Joined: Wed May 03, 2017 12:20 pm

Re: 1.30.2 upgrade breaks API access

Post by gdl »

Good news: With the update of this morning the API is working again on my Ubuntu 16.04 with Zoneminder 1.30.3. Thanks for the support!
ios77
Posts: 2
Joined: Wed May 03, 2017 2:24 pm

Re: 1.30.2 upgrade breaks API access

Post by ios77 »

Update:
apt update
apt install php-apcu-bc
restart apache and zoneminder
fix the probem after upgrade to 1.30.3 on 16.04.....
Mozart
Posts: 17
Joined: Fri Aug 26, 2016 8:41 am

Re: 1.30.2 upgrade breaks API access

Post by Mozart »

Yes, it's working again!
I did:
apt update
apt upgrade
Restant apache2 and Zoneminder
rockedge
Posts: 1173
Joined: Fri Apr 04, 2014 1:46 pm
Location: Connecticut,USA

Re: 1.30.2 upgrade breaks API access

Post by rockedge »

even with the fix in place, the API on 1.30.3 remains broken running on Puppy Linux Tahr 6.0.6 (Ubuntu 14.04 binaries) with a Hiawatha server. Just a blank white page

Code: Select all

127.0.0.1|Thu 04 May 2017 12:48:16 -0400|/usr/share/zoneminder/www/api/app/webroot/index.php|PHP Fatal error:  Call to undefined function apc_fetch() in /usr/share/zoneminder/www/api/lib/Cake/Cache/Engine/ApcEngine.php on line 78
127.0.0.1|Thu 04 May 2017 12:48:16 -0400|/usr/share/zoneminder/www/api/app/webroot/index.php|CGI returned 500 Internal Error
is this problem related to php-apcu missing? any ideas will be appreciated!
bbunge
Posts: 2930
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: 1.30.2 upgrade breaks API access

Post by bbunge »

rockedge wrote: Thu May 04, 2017 4:50 pm even with the fix in place, the API on 1.30.3 remains broken running on Puppy Linux Tahr 6.0.6 (Ubuntu 14.04 binaries) with a Hiawatha server. Just a blank white page

Code: Select all

127.0.0.1|Thu 04 May 2017 12:48:16 -0400|/usr/share/zoneminder/www/api/app/webroot/index.php|PHP Fatal error:  Call to undefined function apc_fetch() in /usr/share/zoneminder/www/api/lib/Cake/Cache/Engine/ApcEngine.php on line 78
127.0.0.1|Thu 04 May 2017 12:48:16 -0400|/usr/share/zoneminder/www/api/app/webroot/index.php|CGI returned 500 Internal Error
is this problem related to php-apcu missing? any ideas will be appreciated!
manually install php5-apc. It is in the WIKI...
rockedge
Posts: 1173
Joined: Fri Apr 04, 2014 1:46 pm
Location: Connecticut,USA

Re: 1.30.2 upgrade breaks API access

Post by rockedge »

I did install php5-apc and activated the module and the API works again!! Thanks....

Turns out all that is needed for a clean upgrade to zm 1.30.3 in Tahrpup 6.0.6 is to install zoneminder_1.30.3-trusty8_i386.deb and php5-apcu_4.0.2-2build1_i386.deb.
make sure the php module is activated fixed a couple permissions and ran zmupdate.pl....now the API works.
Locked