Including bootstrap in a webpage fails


Version info :

Debian 11
FreePBX 16.0.19
PHP 7.4.28

Including /etc/freepbx.conf in a web page gives me the following error :

Error thrown with message "Call to a member function get() on null"

#16 Error in /opt/freepbx/www/admin/libraries/modulefunctions.class.php:746
#15 module_functions:getinfo in /opt/freepbx/www/admin/libraries/BMO/Modules.class.php:340
#14 FreePBX\Modules:getInfo in /opt/freepbx/www/admin/libraries/BMO/Modules.class.php:352
#13 FreePBX\Modules:checkStatus in /opt/freepbx/www/admin/libraries/BMO/Notifications.class.php:596
#12 FreePBX\Notifications:canAddNotification in /opt/freepbx/www/admin/libraries/BMO/Notifications.class.php:140
#11 FreePBX\Notifications:add_error in /opt/freepbx/www/admin/libraries/BMO/Cache.class.php:246
#10 FreePBX\Cache:init in /opt/freepbx/www/admin/libraries/BMO/Cache.class.php:58
#9 FreePBX\Cache:contains in /opt/freepbx/www/admin/libraries/BMO/Modulelist.class.php:65
#8 FreePBX\Modulelist:get in /opt/freepbx/www/admin/libraries/BMO/Modulelist.class.php:19
#7 FreePBX\Modulelist:__construct in /opt/freepbx/www/admin/libraries/BMO/Self_Helper.class.php:124
#6 FreePBX\Self_Helper:autoLoad in /opt/freepbx/www/admin/libraries/BMO/Self_Helper.class.php:37
#5 FreePBX\Self_Helper:__get in /opt/freepbx/www/admin/libraries/modulefunctions.class.php:642
#4 module_functions:getinfo in /opt/freepbx/www/admin/libraries/utility.functions.php:1175
#3 _bootstrap_parse_hooks in /opt/freepbx/www/admin/libraries/utility.functions.php:1151
#2 bootstrap_include_hooks in /opt/freepbx/www/admin/bootstrap.php:292
#1 require_once in /etc/freepbx.conf:10
#0 include in /var/www/repertoire/www/test2.php:2

Here is the content of /var/www/repertoire/www/test2.php :

include '/etc/freepbx.conf';
        <meta charset="UTF-8">
        <h1>Test OK !</h1>

Trying include '/etc/freepbx.conf'; in a php cli with the same php version does not produce any error.

I have multiple questions about this :

  • why do I get a cache error in a web page (#11 FreePBX\Notifications:add_error in /opt/freepbx/www/admin/libraries/BMO/Cache.class.php:246 ) but not in a php cli ?
  • the second error looks like a php version problem, is FreePBX 16 not supposed to work with php 7 ?

PS : opened a ticket about this issue, but it got closed : [FREEPBX-23402] Including bootstrap fails, webpage only - Sangoma Issue Tracker


This is an easy fix : put my apache2 user (www-data) in the “asterisk” group.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.