Please note most tasks should be handled through the FreePBX UI.
You can access the FreePBX GUI by typing one of the above IPâs in to your web br owser.
For support please visit http://www.freepbx.org/support-and-professional-service s
Ive create a symbolic link at /usr/sbin but I got the following error after executing the command
PHP Fatal error: Class âFreePBX\Console\Application\FWApplicationâ not found in /usr/src/freepbx-13.0.1beta2/amp_conf/htdocs/admin/modules/framework/amp_conf/bin/fwconsole on line 65
Basically you (or someone else) blew the install process or any upgrade process offered/followed.
Anyy way you figure it, creating a symlink to a broken program is a little Quixotean, no matter where you put it, no ?
I suggest you start over or experience the immediate pain of alpha software turning into beta software
FreePBX 12 should probably not be relied on for production systems yet, so unless you are in that place, just keep following . . ., They will fix it âsoonâ
I have the following on my 13 box:
lrwxrwxrwx 1 root root 31 May 26 06:57 /usr/sbin/fwconsole -> /var/lib/asterisk/bin/fwconsole
The file contents are below. Try creating the /var/lib file and then linking as described above AT YOUR OWN RISK
Remember: Always create a backup of your âstuffâ before overwriting it.
#!/usr/bin/env php
<?php
$options = getopt("", array("fix_zend"));
/* Optional. Itâs better to do it in the php.ini file */
date_default_timezone_set('America/Los_Angeles');
//Bootstrap to give access to FreePBX internals
$bootstrap_settings['freepbx_auth'] = false;
$bootstrap_settings['fix_zend'] = isset($options['fix_zend']);
//Wrapped in a global try catch incase of zend errors
try {
if (!@include_once(getenv('FREEPBX_CONF') ? getenv('FREEPBX_CONF') : '/etc/freepbx.conf')) {
include_once('/etc/asterisk/freepbx.conf');
}
} catch(\Exception $e) {
if(!isset($options['fix_zend']) && function_exists('SPLAutoloadBroken') && SPLAutoloadBroken()) {
modgettext::push_textdomain("amp");
echo _("Autoloader is damaged")."\n";
$name = isset($argv[0]) ? basename($argv[0]) : "fwconsole";
echo sprintf(_("Please run: %s --fix_zend"),$name)."\n";
exit(5);
} else {
throw $e;
}
}
if(!isset($options['fix_zend']) && function_exists('SPLAutoloadBroken') && SPLAutoloadBroken()) {
echo _("Autoloader is damaged")."\n";
echo sprintf(_("Please run: %s --fix_zend"),basename($argv[0]))."\n";
die();
}
if(isset($options['fix_zend'])) {
if(SPLAutoloadBroken()) {
die(_("Autoloader was damaged before we even started!")."\n");
}
//autoload our fix it classes now before autoloading breaks
$mf = module_functions::create();
error_reporting(0);
$disable = null;
if(!empty($zended) && is_array($zended)) {
foreach($zended as $key => $file) {
if(file_exists($file)) {
bootstrap_include_hooks('pre_module_load', $key);
require_once($file);
bootstrap_include_hooks('post_module_load', $key);
if(SPLAutoloadBroken()) {
$disable = $key;
break;
}
}
}
}
if(!empty($disable)) {
echo sprintf(_("Disabling malfunctioning module: %s"),$disable)."\n";
$mf->disable($disable, true);
exec(__FILE__." --fix_zend",$o);
foreach($o as $line) {
echo $line."\n";
}
}
if(!SPLAutoloadBroken()) {
die(_("There's nothing left to fix")."\n");
exit(0);
}
}
$webrootpath = (isset($amp_conf['AMPWEBROOT']) && !empty($amp_conf['AMPWEBROOT'])) ? $amp_conf['AMPWEBROOT'] : '/var/www/html';
include $webrootpath .'/admin/libraries/FWApplication.class.php';
include $webrootpath .'/admin/libraries/FWHelper.class.php';
include $webrootpath .'/admin/libraries/FWList.class.php';
use Symfony\Component\Console\Application;
use FreePBX\Console\Command;
use FreePBX\Console\Application as App;
try {
$amodules = FreePBX::Modules()->getActiveModules();
$fbc = new App\FWApplication('FW Console - FreePBX Utility', getVersion());
/*
* Framework is not like the others so we load up framework classes first.
*/
$fwcpath = $webrootpath . '/admin/libraries/Console';
$fwclasses = scandir($fwcpath);
foreach ($fwclasses as $class){
if( substr($class , -9) !== 'class.php'){
continue;
}else{
$ifile = $fwcpath . '/' . $class;
if(file_exists($ifile)) {
include $ifile;
$classname = substr($class ,0,-10);
$class = 'FreePBX\\Console\\Command\\' . $classname;
$fbc->add(new $class);
}
}
}
/*
* Dynamic Class Loader. This looks to enabled modules for a Console folder
* Then loads any file.class.php files found in that subdir.
* This doesn't really handle bad includes. If your include in bad
* It will likely break everything!
*/
foreach($amodules as $module){
//Module Path
$mpath = $webrootpath . '/admin/modules/' . $module['rawname'] . '/Console/';
if (file_exists($mpath)){
//Class files
$cfiles = scandir($mpath);
foreach($cfiles as $class){
//ignore anything in this dir that is NOT class.php
if( substr($class , -9) !== 'class.php'){
continue;
}else{
$ifile = $mpath . '/' . $class;
if(!file_exists($ifile)) {
continue;
}
include $ifile;
$classname = substr($class ,0,-10);
$class = 'FreePBX\\Console\\Command\\' . $classname;
if(!class_exists($class)) {
continue;
}
modgettext::push_textdomain($module['rawname']);
$fbc->add(new $class);
modgettext::pop_textdomain();
}
}
}
}
$fbc->run();
} catch(Exception $e) {
echo $e->getMessage()."\n";
}
[root@N ~]# which fwconsole
/usr/bin/which: no fwconsole in (/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)
[root@N~]#
Thanks for this, just for the purposes of my education, I thought that running the scripts would do that - I didnât realise there was a need to do this on the GUI as well - have I got this wrong or are you trying to figure out a workaround for whatever is wrong? Do I then re-run the first upgrade script for Version 13?
Thanks for this - can you be sure that there will not be other problems at this time - would you say itâs worth continuing down this road - if itâs helpful to you I willâŚ
Do you want me to run the same script again after using the PBX updater?
Ah yes, I can see why that would be tricky to comment on, I was too vague. Could there be other problems solely related to the way the install has gone?