Dhtmlxconnector doesnt' work on Linux

Hi

My dhtmlxtree and dhtmlxconnector scripts were working perfectly on WinXP & Apache machine. But when I moved the scripts to Linux hosting, I got the following error.

The connector.php script was supposed to show the xml tags as below

<tree id="0">
<item id="0#19" text="Balaka" child="1" im0="folderClosed.gif" im1="folderOpen.gif" im2="folderClosed.gif"/>
<item id="0#3" text="Blantyre" child="1" im0="folderClosed.gif" im1="folderOpen.gif" im2="folderClosed.gif"/>
<item id="0#13" text="Chikwawa" child="1" im0="folderClosed.gif" im1="folderOpen.gif" im2="folderClosed.gif"/>
<item id="0#12" text="Chiradzulu" child="1" im0="folderClosed.gif" im1="folderOpen.gif" im2="folderClosed.gif"/>
<item id="0#23" text="Chitipa" child="1" im0="folderClosed.gif" im1="folderOpen.gif" im2="folderClosed.gif"/>
<item id="0#8" text="Dedza" child="1" im0="folderClosed.gif" im1="folderOpen.gif" im2="folderClosed.gif"/>
<item id="0#7" text="Dowa" child="1" im0="folderClosed.gif" im1="folderOpen.gif" im2="folderClosed.gif"/>
<item id="0#25" text="Karonga" child="1" im0="folderClosed.gif" im1="folderOpen.gif" im2="folderClosed.gif"/>
<item id="0#6" text="Kasungu" child="1" im0="folderClosed.gif" im1="folderOpen.gif" im2="folderClosed.gif"/>
<item id="0#5" text="Lilongwe" child="1" im0="folderClosed.gif" im1="folderOpen.gif" im2="folderClosed.gif"/>
<item id="0#27" text="Machinga" child="1" im0="folderClosed.gif" im1="folderOpen.gif" im2="folderClosed.gif"/>
<item id="0#28" text="Mangochi" child="1" im0="folderClosed.gif" im1="folderOpen.gif" im2="folderClosed.gif"/>
<item id="0#1" text="Mchinji" child="1" im0="folderClosed.gif" im1="folderOpen.gif" im2="folderClosed.gif"/>
<item id="0#14" text="Mulanje" child="1" im0="folderClosed.gif" im1="folderOpen.gif" im2="folderClosed.gif"/>
<item id="0#11" text="Mwanza" child="1" im0="folderClosed.gif" im1="folderOpen.gif" im2="folderClosed.gif"/>
<item id="0#2" text="Mzimba" child="1" im0="folderClosed.gif" im1="folderOpen.gif" im2="folderClosed.gif"/>
<item id="0#30" text="Mzuzu" child="1" im0="folderClosed.gif" im1="folderOpen.gif" im2="folderClosed.gif"/>
<item id="0#29" text="National" child="1" im0="folderClosed.gif" im1="folderOpen.gif" im2="folderClosed.gif"/>
<item id="0#10" text="Neno" child="1" im0="folderClosed.gif" im1="folderOpen.gif" im2="folderClosed.gif"/>
<item id="0#22" text="Nkhatabay" child="1" im0="folderClosed.gif" im1="folderOpen.gif" im2="folderClosed.gif"/>
<item id="0#21" text="Nkhotakota" child="1" im0="folderClosed.gif" im1="folderOpen.gif" im2="folderClosed.gif"/>
<item id="0#17" text="Nsanje" child="1" im0="folderClosed.gif" im1="folderOpen.gif" im2="folderClosed.gif"/>
<item id="0#9" text="Ntcheu" child="1" im0="folderClosed.gif" im1="folderOpen.gif" im2="folderClosed.gif"/>
<item id="0#26" text="Ntchisi" child="1" im0="folderClosed.gif" im1="folderOpen.gif" im2="folderClosed.gif"/>
<item id="0#15" text="Phalombe" child="1" im0="folderClosed.gif" im1="folderOpen.gif" im2="folderClosed.gif"/>
<item id="0#24" text="Rumphi" child="1" im0="folderClosed.gif" im1="folderOpen.gif" im2="folderClosed.gif"/>
<item id="0#20" text="Salima" child="1" im0="folderClosed.gif" im1="folderOpen.gif" im2="folderClosed.gif"/>
<item id="0#16" text="Thyolo" child="1" im0="folderClosed.gif" im1="folderOpen.gif" im2="folderClosed.gif"/>
<item id="0#18" text="Zomba" child="1" im0="folderClosed.gif" im1="folderOpen.gif" im2="folderClosed.gif"/>
</tree>

here is the source code of connector.php . I would appreciate if anyone can help me with this error. Thanks in advance.

[code]<?php
include_once(“include/library.php”);
$res=mysql_connect($dbLocalAry[‘host’],$dbLocalAry[‘user’],$dbLocalAry[‘password’]);
mysql_select_db($dbLocalAry[‘dbname’]);

require("dhtmlxconnector/treemultitable_connector.php");

$tree = new TreeMultitableConnector($res);
$tree->setMaxLevel(3);
$level = $tree->get_level();

function format_district($item)
{
   $item->set_image("folderClosed.gif","folderOpen.gif","folderClosed.gif");
}
function format_ta($item)
{
   $item->set_image("y_folderClosed.gif","y_folderOpen.gif","y_folderClosed.gif");
}
function format_gvh($item)
{
   $item->set_image("b_folderClosed.gif","b_folderOpen.gif","b_folderClosed.gif");
}


if ($_SESSION[PREFIX.'Level']==LEVEL_DISTRICT)
    $sql="select * from district where ID=".$_SESSION[PREFIX.'DistrictID'];
else
    $sql="select * from district order by NAME ASC";

switch ($level) {
    case 0:
        $tree->event->attach("beforeRender",format_district);
        $tree->render_sql($sql,"ID","NAME","","");
        break;
    case 1:
        $tree->event->attach("beforeRender",format_ta);
        $tree->render_sql("SELECT * from ta order by NAME ASC", "ID", "NAME", "", "DISTRICT_ID");
        
        break;
    case 2:
        $tree->event->attach("beforeRender",format_gvh);
        $tree->render_sql("SELECT * from gvh order by NAME ASC", "ID", "NAME", "", "TA_ID");
        
        break;
    case 3:
        $tree->render_sql("SELECT * from vh order by NAME ASC", "ID", "NAME", "", "GVH_ID");
        break;
}

?>[/code]

I tested the script in another Linux hosting and it works perfectly. Does it has something to do with Apache & PHP setting ?

There is known issue with php version. Some older versions of PHP may cause such issue.
It can be resolved by updating base_connector.php with the attached one.
base_connector.zip (19.3 KB)

the new base_connector.php worked!!!
Thanks,

I’m sorry to bump this 2 month old thread, but I am getting the same XML error.

XML Parsing Error: XML or text declaration not at start of entity

I originally got the error from the current DHTMLX connector v1 PHP being used by DHTMLX Combo to create a XML file.

Unfortunately, I replaced base_connector.php with Stanislav’s updated one and the error still occurs.

I am using PHP Version 5.3.5 (5.3.6 is the newest).

I don’t see an edit button on this forum so I must double post. As long as I keep the

require("connector/combo_connector.php"); $comboconn = new ComboConnector($connection,"MySQL"); $comboconn->render_table("com_people","table_name");?>
At the top of the page containing the combobox then I get a valid XML file back. The problem is that the XML file is displayed right away when accessing the page. I need the XML data to be fed to combobox instead.

The error message, such as in your case can appear if you have some other output before connector, which is corrupting xml.

Be sure that you have not any text output in connector’s file.

Thank you for responding Stanislav. I had not known that I had to place the connection script into a separate .php. I have gotten it to work and written a beginners’ tutorial here.