@mysql_pconnect() and SimpleXML

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
Manu_7
Forum Newbie
Posts: 1
Joined: Tue Mar 24, 2009 10:49 am

@mysql_pconnect() and SimpleXML

Post by Manu_7 »

Hi every one,

Since today (about 13h) i' m getting problems to parse an XML document for some reason I totaly ignore because suddenly the same code that I didn´t change for more than one week isn't working know. Here is the code, but 99,99% sure it doesn't come from it (was really working weel until this afternoon). Here is my PHP code :

Code: Select all

$resProj = curl_process ($urlProj, $user, $pass);
        $proj_xml = new SimpleXMLElement($resProj);
Really don' t think we have to stay to much time on it because as I told it´s been working well until now (curl_process works well, problem is using the new SimpleXMLElement() )

I started debugged it (I'm using Eclipse 3.4.1 and PHP 5). After going through a lot of php files and classes called automatically when using SimpleXML, I finally arrived to an SessionHandlerLite.inc file in which the debuggor stoped in this function :

Code: Select all

public static function close()
    {
        global $dbs;
        // close database-connection
        return @mysql_close($dbs);
    }
Seems there is a problem to close a connection to a database that I all ignore about, because i' m not connecting or using any, but I guess to parse an xml document with SimpleXML it should call some defined Classes and some defined functions that I normally even look at. I shall precise I'm starting with PHP and discover this way (SimpleXML) to start using xml files (I know there are other ways to do it, but once again until now it was working great and just sufficiently easy for me :) )

Just before this close function, there is the open function which uses the @mysql_pconnect

Code: Select all

public static function open($savePath, $sessName)
    {
        global $dbs;
        // open database-connection
        $host = trim(file_get_contents("/xxx/xxx"))=="dev" ? "server.company.com" : "192.xxx.xxx.xxx";
        $dbName = "php_sessions";
        $dbHandle = @mysql_pconnect($host,"xxxx","xxxx");
        $dbSel = @mysql_select_db($dbName,$dbHandle);
        // return success
        if(!$dbHandle || !$dbSel)
            return false;
        $dbs = $dbHandle;
        return true;
    }
The errors returned are :
Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: Entity: line 1: parser error : Start tag expected, '<' not found in /home/xx/xx/xx/xx/xx/xx/envio_datos.php on line 137
and
Exception: String could not be parsed as XML in /home/xx/xx/xx/xx/xx/xx/envio_datos.php on line 137
And here finally are my questions :

Can it be linked to one of this two mysql functions, particulary @mysql_pconnect() because I saw on Internet it could have problems using this instead of mysql_connect(), but why should it happen only know ?

Is it possibly due to a server fall ? In this case which one ? One in my company or one mysql database o server referenced in some default library ?

How could you explain the fact that the same piece of code was working grate since one month and suddenly not any more ?

Do you need more information for my problem ? I don't really know what kind of information could be useful due to my lack of experience ...

Anyway any help should really be great, even if it is for telling me I have to go through DOM instead of SimpleXML :)

Thanks.
Post Reply