FreePBX failed to start

NethServer Version: NethServer release 7.8.2003 (final)
Module: FreePBX

I’m try to install FreePBX.

* asterisk.service - Asterisk PBX and telephony daemon.
   Loaded: loaded (/usr/lib/systemd/system/asterisk.service; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/asterisk.service.d
           `-cdr.conf
   Active: activating (auto-restart) (Result: exit-code) since Sat 2020-05-30 22:54:00 +10; 3s ago
  Process: 16287 ExecStart=/usr/sbin/asterisk -f -C /etc/asterisk/asterisk.conf (code=exited, status=127)
 Main PID: 16287 (code=exited, status=127)

May 30 22:54:00 mydomain.ru systemd[1]: asterisk.service: main process exited, code=exited, status=127/n/a
May 30 22:54:00 mydomain.ru systemd[1]: Unit asterisk.service entered failed state.
May 30 22:54:00 mydomain.ru systemd[1]: asterisk.service failed.

Terminal:
fwconsole restart

PHP Parse error:  syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /var/www/html/freepbx/admin/libraries/Composer/vendor/symfony/translation/Translator.php on line 90
Whoops\Exception\ErrorException: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in file /var/www/html/freepbx/admin/libraries/Composer/vendor/symfony/translation/Translator.php on line 90
Stack trace:
  1. Whoops\Exception\ErrorException->() /var/www/html/freepbx/admin/libraries/Composer/vendor/symfony/translation/Translator.php:90

Goole it… It need php 5.6.
OK, go to https://wiki.nethserver.org/doku.php?id=php-scl and…

yum install http://mirror.de-labrusse.fr/NethServer/7/x86_64/nethserver-stephdl-1.1.0-1.ns7.sdl.noarch.rpm
yum install http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
yum install nethserver-php-scl --enablerepo=stephdl,remi-safe

Long wait… It install php 5.6, 7.1, 7.2 and I check…

php -v

PHP 5.4.16 (cli) (built: Apr  1 2020 04:07:17) 
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies

Nothing changed.

How to change to use installed php v.5.6?

1 Like

See https://docs.nethserver.org/en/v7/freepbx.html

:wink:

@Vladimir_Pobedinskiy

Hello Vladimir

NethServer 7.8 is based on Centos, which still ships with PHP v5.6, albeit an improved version with backports.
With the PHPscl, you can choose for each vHost what PHP Version you want, there are several versions of PHP running on your server now. If you don’t query the right version, PHP v5.6 will always be shown.

My 2 cents
Andy

On NethServer FreePBX (asterisk service) already uses php 5.6 (rh-php56 from SCL redhat software collection). What you see with php -v is the “system wide” php version shipped with CentOS.

I don’t use freepbx, but maybe you can drop a phpinfo file in freepbx/asterisk directory or check if the related services (httpd-fpbx, rh-php56-php*) are running.

service httpd-fpbx status

Show output...
Redirecting to /bin/systemctl status httpd-fpbx.service
● httpd-fpbx.service - The Apache HTTP Server instance for FreePBX
   Loaded: loaded (/usr/lib/systemd/system/httpd-fpbx.service; enabled; vendor preset: disabled)
   Active: active (running) since Пн 2020-06-01 10:16:06 +10; 6min ago
     Docs: man:httpd(8)
           man:apachectl(8)
 Main PID: 1613 (httpd)
   Status: "Total requests: 3; Current requests/sec: 0; Current traffic:   0 B/sec"
    Tasks: 7
   CGroup: /system.slice/httpd-fpbx.service
           ├─1613 /usr/sbin/httpd -f /etc/httpd/fpbx-conf/httpd.conf -DFOREGROUND
           ├─3111 /usr/sbin/httpd -f /etc/httpd/fpbx-conf/httpd.conf -DFOREGROUND
           ├─3116 /usr/sbin/httpd -f /etc/httpd/fpbx-conf/httpd.conf -DFOREGROUND
           ├─3119 /usr/sbin/httpd -f /etc/httpd/fpbx-conf/httpd.conf -DFOREGROUND
           ├─3121 /usr/sbin/httpd -f /etc/httpd/fpbx-conf/httpd.conf -DFOREGROUND
           ├─3123 /usr/sbin/httpd -f /etc/httpd/fpbx-conf/httpd.conf -DFOREGROUND
           └─9524 /usr/sbin/httpd -f /etc/httpd/fpbx-conf/httpd.conf -DFOREGROUND

июн 01 10:15:44 *****ru systemd[1]: Starting The Apache HTTP Server instance for FreePBX...
июн 01 10:16:06 *****ru systemd[1]: Started The Apache HTTP Server instance for FreePBX.

It not contain information that help to me solve problem.
I execute next command into terminal, but service FreePBX service not running.

/usr/bin/scl enable rh-php56 “/usr/sbin/fwconsole”

Show output...
FW Console - FreePBX Utility 14.0.13.12

Usage:
  command [options] [arguments]

Options:
  -h, --help            Display this help message
  -q, --quiet           Do not output any message
  -V, --version         Display this application version
      --ansi            Force ANSI output
      --no-ansi         Disable ANSI output
  -n, --no-interaction  Do not ask any interactive question
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Available commands:
  chown          Change ownership of files
  context        [cx] Shows the specified context from the dialplan
  debug          [dbug] Stream files for debugging
  doctrine       Run a doctrine commands
  extip          [externalip] Get External IP
  help           Displays help for a command
  job            Centralized job management
  kvstore        Manage kvstore
  list           Lists commands
  localization   Localization Utilities
  moduleadmin    [ma] Module Administration
  motd           Prints MOTD
  mysql          [m] Run a mysql Query:
  notifications  [notification] Manage notifications
  reload         [r] Reload Configs
  restart        Start Asterisk and run other needed FreePBX commands
  session        Manage Session
  setting        [set] View and update settings
  start          Start Asterisk and run other needed FreePBX commands
  stop           Stop Asterisk and run other needed FreePBX commands
  system         [sysup|sys|systemupdate] System Update Administration
  trunks         Enable and disable trunks from the command line
  unlock         Unlock Session
  updatemanager  [msm|modulesystemmanager] View and change Update/Notification Manager Settings
  util           Common utilities
  validate       Validate your PBX against potential hacks

I need php version 5.6 to be used by default for FreePBX.

When I try to go to dashboad:

freepbx.log

[2020-May-22 03:55:11] [INFO] (libraries/modulefunctions.class.php:2013) - Updating tables admin, ampusers, cronmanager, featurecodes, freepbx_log, freepbx_settings, globals, module_xml, modules, notifications, cron_jobs...Done
[2020-May-22 03:55:11] [INFO] (framework/install.php:167) - No directory /var/www/html/freepbx/admin/modules/framework/amp_conf/htdocs, install script not needed
[2020-May-22 03:55:11] [UPDATE] (libraries/modulefunctions.class.php:2024) - Module: framework installed at version 14.0.13.12
[2020-May-22 03:55:13] [INFO] (libraries/modulefunctions.class.php:2086) - Generating CSS...Done
[2020-May-22 03:55:16] [INFO] (libraries/modulefunctions.class.php:2013) - Updating tables trunks, pjsip, sip, dahdi, iax, indications_zonelist, devices, users, incoming, outbound_routes, dahdichandids, outbound_route_patterns, outbound_route_sequence, outbound_route_trunks, outbound_routes, trunk_dialpatterns...Done
[2020-May-22 03:55:16] [INFO] (core/install.php:439) - Migrating pickup groups to named pickup groups
[2020-May-22 03:55:16] [INFO] (core/install.php:444) - Migrating call groups to named call groups
[2020-May-22 03:55:16] [INFO] (core/install.php:483) - Checking for possibly invalid emergency caller id fields..none found
[2020-May-22 03:55:17] [INFO] (core/install.php:1028) - Migrating old media encryption values...done
[2020-May-22 03:55:17] [INFO] (core/install.php:1051) - Removing encoding on incoming routes alertinfo values...done
[2020-May-22 03:55:17] [UPDATE] (libraries/modulefunctions.class.php:2024) - Module: core installed at version 14.0.28.19
[2020-May-22 03:55:17] [INFO] (libraries/modulefunctions.class.php:2086) - Generating CSS...Done
[2020-May-22 03:55:18] [UPDATE] (libraries/modulefunctions.class.php:2024) - Module: dashboard installed at version 14.0.8
[2020-May-22 03:55:18] [INFO] (libraries/modulefunctions.class.php:2086) - Generating CSS...Done
[2020-May-22 03:55:18] [INFO] (sipsettings/install.php:66) - checking for sipsettings table..none, creating table
[2020-May-22 03:55:18] [NOTICE] (BMO/Notifications.class.php:507) - [NOTIFICATION]-[sipsettings]-[BINDPORT] - Default bind port for CHAN_PJSIP is: 5060, CHAN_SIP is: 5160 (The default bind ports for FreePBX have changed. Please keep this is mind while configuring your devices. You can change this in SIP Settings. CHAN_PJSIP is: 5060, CHAN_SIP is: 5160)
[2020-May-22 03:55:18] [INFO] (sipsettings/install.php:99) - populating default codecs..ulaw, alaw, gsm, g726 added
[2020-May-22 03:55:18] [INFO] (sipsettings/install.php:218) - Migrating Audio Codecs
[2020-May-22 03:55:18] [UPDATE] (libraries/modulefunctions.class.php:2024) - Module: sipsettings installed at version 14.0.27.17
[2020-May-22 03:55:18] [INFO] (libraries/modulefunctions.class.php:2086) - Generating CSS...Done
[2020-May-22 03:55:19] [INFO] (voicemail/install.php:101) - Checking for General Setting migrations..not needed
[2020-May-22 03:55:19] [INFO] (voicemail/install.php:114) - OPERATOR_XTN added
[2020-May-22 03:55:19] [INFO] (voicemail/install.php:114) - VM_OPTS added
[2020-May-22 03:55:19] [INFO] (voicemail/install.php:114) - VM_GAIN added
[2020-May-22 03:55:19] [INFO] (voicemail/install.php:114) - VM_DDTYPE added
[2020-May-22 03:55:19] [INFO] (voicemail/install.php:114) - VMX_OPTS_LOOP added
[2020-May-22 03:55:19] [INFO] (voicemail/install.php:114) - VMX_OPTS_DOVM added
[2020-May-22 03:55:19] [INFO] (voicemail/install.php:114) - VMX_TIMEOUT added
[2020-May-22 03:55:19] [INFO] (voicemail/install.php:114) - VMX_REPEAT added
[2020-May-22 03:55:19] [INFO] (voicemail/install.php:114) - VMX_LOOPS added
[2020-May-22 03:55:19] [WARNING] (libraries/modulefunctions.legacy.php:7) - Depreciated Function modules_getversion detected in /var/www/html/freepbx/admin/modules/voicemail/install.php on line 167
[2020-May-22 03:55:19] [WARNING] (libraries/modulefunctions.legacy.php:7) - Depreciated Function module_getinfo detected in /var/www/html/freepbx/admin/modules/voicemail/install.php on line 186
[2020-May-22 03:55:19] [INFO] (voicemail/install.php:188) - checking if Voicemail Admin (vmailadmin) is installed..not installed, ok
[2020-May-22 03:55:19] [UPDATE] (libraries/modulefunctions.class.php:2024) - Module: voicemail installed at version 14.0.6.7
[2020-May-22 03:55:19] [INFO] (libraries/modulefunctions.class.php:2086) - Generating CSS...Done
[2020-May-22 13:55:20] [UPDATE] (libraries/modulefunctions.class.php:2024) - Module: callrecording installed at version 14.0.15
[2020-May-22 13:55:20] [INFO] (libraries/modulefunctions.class.php:2086) - Generating CSS...Done
[2020-May-30 22:16:01] [CRITICAL] (admin/bootstrap.php:260) - Connection attmempt to AMI failed
[2020-May-30 22:32:06] [CRITICAL] (admin/bootstrap.php:260) - Connection attmempt to AMI failed
[2020-May-30 22:48:37] [CRITICAL] (admin/bootstrap.php:260) - Connection attmempt to AMI failed
[2020-Jun-01 09:13:19] [CRITICAL] (admin/bootstrap.php:260) - Connection attmempt to AMI failed
[2020-Jun-01 09:17:56] [CRITICAL] (admin/bootstrap.php:260) - Connection attmempt to AMI failed
[2020-Jun-01 09:23:29] [CRITICAL] (admin/bootstrap.php:260) - Connection attmempt to AMI failed
[2020-Jun-01 09:27:37] [CRITICAL] (admin/bootstrap.php:260) - Connection attmempt to AMI failed
[2020-Jun-01 09:28:14] [CRITICAL] (admin/bootstrap.php:260) - Connection attmempt to AMI failed
[2020-Jun-01 09:29:43] [CRITICAL] (admin/bootstrap.php:260) - Connection attmempt to AMI failed
[2020-Jun-01 10:10:05] [CRITICAL] (admin/bootstrap.php:260) - Connection attmempt to AMI failed
[2020-Jun-01 10:10:19] [CRITICAL] (admin/bootstrap.php:260) - Connection attmempt to AMI failed
[2020-Jun-01 10:11:02] [CRITICAL] (admin/bootstrap.php:260) - Connection attmempt to AMI failed
[2020-Jun-01 10:11:11] [CRITICAL] (admin/bootstrap.php:260) - Connection attmempt to AMI failed
[2020-Jun-01 10:17:49] [CRITICAL] (admin/bootstrap.php:260) - Connection attmempt to AMI failed
[2020-Jun-01 10:31:48] [CRITICAL] (admin/bootstrap.php:260) - Connection attmempt to AMI failed
[2020-Jun-01 10:51:10] [CRITICAL] (admin/bootstrap.php:260) - Connection attmempt to AMI failed

/etc/asterisk/manager.conf

[general]
enabled = yes
port = 5038
bindaddr = 0.0.0.0
displayconnects=no ;only effects 1.6+

[admin]
secret = fa88de3b38c7d6626ba61da7a439808d
deny=0.0.0.0/0.0.0.0
permit=127.0.0.1/255.255.255.0
read = system,call,log,verbose,command,agent,user,config,command,dtmf,reporting,cdr,dialplan,originate,message
write = system,call,log,verbose,command,agent,user,config,command,dtmf,reporting,cdr,dialplan,originate,message
writetimeout = 5000

#include manager_additional.conf
#include manager_custom.conf

I’m install asterisk from sources. Now it running. But FreePBX dashboard not opened.

Show image

/var/log/asterisk/messages

[Jun  1 14:47:20] Asterisk 16.10.0 built by root @ mtrs.hldns.ru on a x86_64 running Linux on 2020-05-22 03:16:25 UTC
[Jun  1 14:47:20] NOTICE[3664] loader.c: 331 modules will be loaded.
[Jun  1 14:47:30] NOTICE[3664] res_config_ldap.c: No directory user found, anonymous binding as default.
[Jun  1 14:47:30] ERROR[3664] res_config_ldap.c: No directory URL or host found.
[Jun  1 14:47:30] ERROR[3664] res_config_ldap.c: Cannot load LDAP RealTime driver.
[Jun  1 14:47:31] ERROR[3664] res_config_pgsql.c: PostgreSQL RealTime: Failed to connect database asterisk on 127.0.0.1: 
[Jun  1 14:47:31] WARNING[3664] res_config_pgsql.c: PostgreSQL RealTime: Couldn't establish connection. Check debug.
[Jun  1 14:47:31] WARNING[3664] res_config_mysql.c: MySQL RealTime: No database user found, using 'asterisk' as default.
[Jun  1 14:47:31] WARNING[3664] res_config_mysql.c: MySQL RealTime: No database password found, using 'asterisk' as default.
[Jun  1 14:47:31] WARNING[3664] res_config_mysql.c: MySQL RealTime: No database host found, using localhost via socket.
[Jun  1 14:47:31] WARNING[3664] res_config_mysql.c: MySQL RealTime: No database name found, using 'asterisk' as default.
[Jun  1 14:47:31] WARNING[3664] res_config_mysql.c: MySQL RealTime: No database port found, using 3306 as default.
[Jun  1 14:47:31] WARNING[3664] res_config_mysql.c: MySQL RealTime: No database socket found, using '/var/lib/mysql/mysql.sock' as default.
[Jun  1 14:47:31] WARNING[3664] res_config_mysql.c: MySQL RealTime: No database socket found (and unable to detect a suitable path).
[Jun  1 14:47:31] NOTICE[3664] cdr.c: CDR simple logging enabled.
[Jun  1 14:47:32] NOTICE[3664] res_smdi.c: No SMDI interfaces are available to listen on, not starting SMDI listener.
[Jun  1 14:47:32] WARNING[3664] res_phoneprov.c: Unable to find a valid server address or name.
[Jun  1 14:47:32] NOTICE[3664] chan_skinny.c: Configuring skinny from skinny.conf
[Jun  1 14:47:33] ERROR[3664] ari/config.c: No configured users for ARI
[Jun  1 14:47:33] NOTICE[3664] confbridge/conf_config_parser.c: Adding default_menu menu to app_confbridge
[Jun  1 14:47:33] NOTICE[3664] cdr_pgsql.c: cdr_pgsql configuration contains no global section, skipping module load.
[Jun  1 14:47:33] NOTICE[3664] cel_custom.c: No mappings found in cel_custom.conf. Not logging CEL to custom CSVs.
[Jun  1 14:47:33] WARNING[3664] cel_pgsql.c: CEL pgsql config file missing global section.
[Jun  1 14:47:33] NOTICE[3664] cel_tds.c: cel_tds has no global category, nothing to configure.
[Jun  1 14:47:33] WARNING[3664] cel_tds.c: cel_tds module had config problems; declining load
[Jun  1 14:47:34] WARNING[3664] loader.c: Some non-required modules failed to load.
[Jun  1 14:47:34] ERROR[3664] loader.c: Error loading module 'app_jack.so': libresample.so.1: cannot open shared object file: No such file or directory
[Jun  1 14:47:34] ERROR[3664] loader.c: Error loading module 'res_srtp.so': libsrtp.so.0: cannot open shared object file: No such file or directory
[Jun  1 14:47:34] ERROR[3664] loader.c: res_pjsip_transport_websocket declined to load.
[Jun  1 14:47:34] ERROR[3664] loader.c: cdr_sqlite3_custom declined to load.
[Jun  1 14:47:34] ERROR[3664] loader.c: cdr_pgsql declined to load.
[Jun  1 14:47:34] ERROR[3664] loader.c: cdr_tds declined to load.
[Jun  1 14:47:34] ERROR[3664] loader.c: cel_sqlite3_custom declined to load.
[Jun  1 14:47:34] ERROR[3664] loader.c: cel_tds declined to load.