S.O.S ! XML error: not well-formed (invalid token) at line 15

I have a major problem. I have a production box with [email protected] 2.7 installed. I have upgraded from amp to freepbx on it. Since it is asterisk 1.2 it is the older version of freepbx. (freePBX 2.3.0 alpha) I have already installed capstral, nerdvittels telephone reminders and I have also bought the licenses for Alison 5 simultaneous calls.
Everything worked fine. I installed Teleyapper 4.0 and it worked great. Then I installed telephonebook from wget http://www.highness.com/typhonebook.pbx
Then I wen on to setup to go to module admin in install it locally. But to my horror, this is the message I am getting.
XML error: not well-formed (invalid token) at line 15
So I can not see anything in setup. I can still see CDR reports, Panel and recordings. But I can not see tools or setup.
The address for setup is http://myasteriskip/admin/config.php?type=setup
The address for tools is http://myasteriskip/admin/config.php?type=tool
Error message for both is same:
XML error: not well-formed (invalid token) at line 15
Here is the code in the first few lines in config.php
Here is code

<?php /* $Id: config.php 3906 2007-04-05 17:49:12Z p_lindheimer $ */ //Copyright (C) 2004 Coalescent Systems Inc. ([email protected]) // //This program is free software; you can redistribute it and/or //modify it under the terms of the GNU General Public License //as published by the Free Software Foundation; either version 2 //of the License, or (at your option) any later version. // //This program is distributed in the hope that it will be useful, //but WITHOUT ANY WARRANTY; without even the implied warranty of //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //GNU General Public License for more details. $title = "freePBX administration"; $type = isset($_REQUEST['type'])?$_REQUEST['type']:'setup'; $display = isset($_REQUEST['display'])?$_REQUEST['display']:''; $extdisplay = isset($_REQUEST['extdisplay'])?$_REQUEST['extdisplay']:null; $skip = isset($_REQUEST['skip'])?$_REQUEST['skip']:0; $action = isset($_REQUEST['action'])?$_REQUEST['action']:null; $quietmode = isset($_REQUEST['quietmode'])?$_REQUEST['quietmode']:''; // determine module type to show, default to 'setup' if($type == "tool") { $message = "Tools"; $fpbx_menu = array( 'modules' => array('category' => 'System Administration', 'name' => 'Module Admin', 'sort' => 0) ); } elseif($type == "cdrcost") { $message = "Call Cost"; } else { $message = "Setup"; } require_once('common/php-asmanager.php'); require_once('functions.inc.php'); // get settings $amp_conf = parse_amportal_conf("/etc/amportal.conf"); $asterisk_conf = parse_asterisk_conf(rtrim($amp_conf["ASTETCDIR"],"/")."/asterisk.conf"); $astman = new AGI_AsteriskManager(); if (! $res = $astman->connect("", $amp_conf["AMPMGRUSER"] , $amp_conf["AMPMGRPASS"])) { unset( $astman ); } include 'header_auth.php'; // get all enabled modules // active_modules array used below and in drawselects function and genConf function $active_modules = module_getinfo(false, MODULE_STATUS_ENABLED); // include any module global functions // add module sections to $fpbx_menu if(is_array($active_modules)){ foreach($active_modules as $key => $module) { //include module functions if (is_file("modules/{$key}/functions.inc.php")) { require_once("modules/{$key}/functions.inc.php"); } //create an array of module sections to display // only of the type we are displaying though // stored as [items][$type][$category][$name] = $displayvalue if (isset($module['items']) && is_array($module['items'])) { // loop through the types foreach($module['items'] as $itemKey => $item) { if ($item['type'] == $type) { // item is an assoc array, with at least array(name=>, category=>, type=>) $fpbx_menu[$itemKey] = $item; } } } } } // new gui hooks if(is_array($active_modules)){ foreach($active_modules as $key => $module) { if (isset($module['items']) && is_array($module['items'])) { foreach($module['items'] as $itemKey => $itemName) { //list of potential _configpageinit functions $initfuncname = $key . '_' . $itemKey . '_configpageinit'; if ( function_exists($initfuncname) ) { $configpageinits[] = $initfuncname; } } } //check for module level (rather than item as above) _configpageinit function $initfuncname = $key . '_configpageinit'; if ( function_exists($initfuncname) ) { $configpageinits[] = $initfuncname; } } } // extensions vs device/users ... this is a bad design, but hey, it works if (isset($amp_conf["AMPEXTENSIONS"]) && ($amp_conf["AMPEXTENSIONS"] == "deviceanduser")) { unset($fpbx_menu["extensions"]); } else { unset($fpbx_menu["devices"]); unset($fpbx_menu["users"]); } if (is_array($fpbx_menu)) { foreach ($fpbx_menu as $key => $value) { // check access if ($_SESSION["AMP_user"]->checkSection($key)) { // if the module has it's own translations, use them for displaying menu item if (extension_loaded('gettext')) { if (is_dir("modules/{$key}/i18n")) { bindtextdomain($key,"modules/{$key}/i18n"); bind_textdomain_codeset($key, 'utf8'); textdomain($key); } else { bindtextdomain('amp','./i18n'); textdomain('amp'); } } } else { // they don't have access to this, remove it completely unset($fpbx_menu[$key]); } } } if (!$quietmode) { if (is_array($fpbx_menu)) { $category = Array(); $sort = Array(); $name = Array(); // Sorting menu by category and name foreach ($fpbx_menu as $key => $row) { $category[$key] = $row['category']; $sort[$key] = $row['sort']; $name[$key] = $row['name']; } if ($amp_conf['USECATEGORIES']) { array_multisort( $category, SORT_ASC, $sort, SORT_ASC, SORT_NUMERIC, $name, SORT_ASC, $fpbx_menu ); } else { array_multisort( $sort, SORT_ASC, SORT_NUMERIC, $name, SORT_ASC, $fpbx_menu ); } // Printing menu echo "
    \n"; $prev_category = ''; foreach ($fpbx_menu as $key => $row) { if ($amp_conf['USECATEGORIES'] && ($row['category'] != $prev_category)) { echo "\t\t
  • "._($row['category'])."
  • \n"; $prev_category = $row['category']; } $href = isset($row['href']) ? $row['href'] : "config.php?type=".$type."&display=".$key; $extra_attributes = ''; if (isset($row['target'])) { $extra_attributes .= ' target="'.$row['target'].'"'; } echo "\t'._($row['name'])."\n"; } echo "
\n\n"; } echo "
\n"; echo "
\n"; echo "
\n"; echo "
\n"; echo "
"._("WARNING: Javascript is disabled in your browser. The freePBX administration interface requires Javascript to run properly. Please enable javascript or switch to another browser that supports it.")."
"; } // check access if ( ($display != '') && !isset($fpbx_menu[$display]) ) { $display = "noaccess"; } // load the component from the loaded modules if ( $display != '' && isset($configpageinits) && is_array($configpageinits) ) { $currentcomponent = new component($display,$type); // call every modules _configpageinit function which should just // register the gui and process functions for each module, if relevent // for this $display foreach ($configpageinits as $func) { $func($display); } // now run each 'process' function and 'gui' function $currentcomponent->processconfigpage(); $currentcomponent->buildconfigpage(); } // show the appropriate page switch($display) { default: //display the appropriate module page if (!isset($active_modules) || (isset($active_modules) && !is_array($active_modules))) { break; } foreach ($active_modules as $modkey => $module) { if (!isset($module['items']) || (isset($module['items']) && !is_array($module['items']))){ continue; } foreach (array_keys($module['items']) as $item){ if ($display != $item) { continue; } // modules can use their own translation files if (extension_loaded('gettext')) { if(is_dir("./modules/{$modkey}/i18n")) { bindtextdomain($modkey,"./modules/{$modkey}/i18n"); bind_textdomain_codeset($modkey, 'utf8'); textdomain($modkey); } } //TODO Determine which item is this module displaying. Currently this is over the place, we should standarize on a "itemid" request var for now, we'll just cover all possibilities :-( $possibilites = array( 'userdisplay', 'extdisplay', 'id', 'itemid', 'category', 'selection' ); $itemid = ''; foreach($possibilites as $possibility) { if ( isset($_REQUEST[$possibility]) && $_REQUEST[$possibility] != '' ) $itemid = $_REQUEST[$possibility]; } // create a module_hook object for this module's page $module_hook = new moduleHook; // populate object variables $module_hook->install_hooks($itemid,$modkey,$item); // let hooking modules process the $_REQUEST $module_hook->process_hooks($itemid,$modkey,$item,$_REQUEST); // include the module page include "modules/{$modkey}/page.{$item}.php"; // global component if ( isset($currentcomponent) ) { echo $currentcomponent->generateconfigpage(); } } } break; case 'noaccess': echo "

"._("Not found")."

"; echo "

"._("The section you requested does not exist or you do not have access to it.")."

"; break; case 'modules': include 'page.modules.php'; break; case '': if ($astman) { printf( "


", dgettext("welcome page", "Welcome to freePBX.") ); $modules_needup = module_getinfo(false, MODULE_STATUS_NEEDUPGRADE); $modules_broken = module_getinfo(false, MODULE_STATUS_BROKEN); if (count($modules_needup) || count($modules_broken)) { echo "
"; if (count($modules_needup)) { echo "

"._("Warning: The following modules are disabled because they need upgrading: "); echo implode(", ",array_keys($modules_needup)); echo "

"; } if (count($modules_broken)) { echo "

"._("Warning: The following modules are disabled because they are broken: "); echo implode(", ",array_keys($modules_broken)); echo "

"; } echo "

", sprintf(dgettext("welcome page","You should go to the Module Admin page to fix these.

"), "config.php?display=modules&type=tool"); echo "
"; } // BETA code - remove later. echo "
"; printf( "


", dgettext("welcome page", "You are running Release Candidate 1 of freePBX. This release is a final test before we make the official 2.2.0 freePBX release. We are unaware of any major bugs in this release, and urge users to report any that they find.") ); printf( "


" , dgettext("welcome page", "Currently known bugs are maintained on this TRAC page. If you find a bug, please create a bug report (you need to create an account - this is to avoid spammers) and the bug report will immediately appear on the TRAC page so that it can be easily tracked by other users.") ); echo "
"; printf( "" , dgettext("welcome page", "Note, presently, Microsoft's Internet Explorer is not a supported web browser, and you must use a standards compliant browser, such as Firefox. There is a link on the right hand side of freePBX.org that will allow you to download Firefox easily. By using that link, Google will donate US$1 to the freePBX project.") ); if ($amp_conf['AMPMGRPASS'] == 'amp111') { printf( "


", dgettext("welcome text", "Warning: You are running freePBX and ").$amp_conf['AMPENGINE'].dgettext("welcome page", " with the default manager pass. You should consider changing this to something else.")." ".sprintf('(%s)', _("Help")) ); } if ( ($amp_conf["AMPDBENGINE"] == "mysql") || ($amp_conf["AMPDBENGINE"] == "pgsql")) { if ($amp_conf['AMPDBPASS'] == 'amp109') { printf( "


", dgettext("welcome text", "Warning: You are running freePBX and ").$amp_conf['AMPDBENGINE'].dgettext("welcome page", " with the default password ")." ".sprintf('(%s)', _("Help")) ); } } printf( "


" , dgettext("welcome page", "If you're new to freePBX, Welcome. Here are some quick instructions to get you started") ); echo "

"; printf( dgettext("welcome page", "There are a large number of Plug-in modules available from the Online Repository. This is available by clicking on the Tools menu up the top, then Module Admin, then Check for updates online. Modules are updated and patched often, so if you are having a problem, it's worth checking there to see if there's a new version of the module available."), "config.php?type=tool", "config.php?display=modules&type=tool", "config.php?display=modules&type=tool&extdisplay=online" ); echo "

\n"; echo "

"; printf( dgettext( "welcome page", "If you're having any problems, you can also use the Online Support module (you need to install this through the Module Repository first) to talk to other users and the devlopers in real time. Click on Start IRC, when the module is installed, to start a Java IRC client." ), "config.php?type=tool&display=irc", "config.php?display=modules&type=tool&extdisplay=online", "config.php?type=tool&display=irc&action=start" ); echo "

\n"; echo "

"; printf( dgettext( "welcome page", "There is also a community based freePBX Web Forum where you can post questions and search for answers for any problems you may be having."), "http://forums.freepbx.org" ); echo "

\n"; print( "

" . _("We hope you enjoy using freePBX!") . "

\n" ); } // no manager, no connection to asterisk else { echo "

\n"; echo "" . _("Warning:") . "\n"; echo "
"; echo "
\n"; echo _("Cannot connect to Asterisk Manager with "). "" .$amp_conf["AMPMGRUSER"] . ""; echo "
"; echo _("Asterisk may not be running."); echo "
\n"; } break; } if (!$quietmode) { echo "\t
\n"; include('footer.php'); echo "
\n"; echo " \n"; echo "\n"; echo "\n"; } ?>

What went wrong.
Please help me!!! This is really urgent.
Thanks in advance.

First - you are running alpha code and it’s generally best to get yourself updated to something production stable, whether that is the latest 2.3 code or the latest 2.4 code (recommended). Asterisk 1.2 and 1.4 are supported on both, there is no issue with 1.2.

Next - it sounds like the introduction of the new module introduced some corrupted xml code. Go into the file system and move or delete the new module you added (form /var/www/html/admin/modules). Afterwards, hopefully, you will be back in control. It may indicate that module is broken (you can uninstall it and ignore errors it may claim). Then, before trying to reinstall the module, make sure that the xml is not corrupted. The xml is the module.xml file that comes with each module.

Philippe, You are a genius, my savior.
It worked. I deleted the resapective folders and everything worked great.
Is it safe to upgrade the freepbx in asterisk 1.2? Should I go ahead and do that. Can I also reinstall that application and see if it works?
Thanks a million.

there’s a great ‘thanks’ button on the upper left corner of the screen:-)

you are safe to upgrade, from an alpha version though, you probably want to use the tarball to upgrade vs. the online module system. FreePBX detects the Asterisk version and adjusts accordingly when you press the orange bar.

You are welcome to try the app as long as you are comfortable doing the recovery.

Yes of course, I see that, and I sure will. (Thank you and you deserve it)
Could you let me know the step by step link for UPGRADING freepbx using tarball?

I found the instructions. I will upgrade it. Thanks and regards