"Premature End of Data" Error with PHP

Premature end of data error with PHP

I had the same problem and fixed it using an UPDATE query like this:

UPDATE mysql.user SET Password = PASSWORD('newpwd') WHERE Host = 'some_host' AND User = 'some_user';

Don't know why but SET Password didn't work.

To be sure that the problem is the one i think you should do this query on the mysql database:

SELECT
`user`.`Password`
FROM
`user`
WHERE
`user`.`User` = 'youruser' AND
`user`.`Host` = 'yourhost'

if the password doesn't start with a * the problem is that you still have the old encription

EDIT _ Here is a php function to create valid password for MYSQL (taken from here):

function mysql_41_password($in)
{
$p=sha1($in,true);
$p=sha1($p);
return "*".strtoupper($p);
}

Thene you can set the password manually:

//newpwd is the passowr dgenerated in php
UPDATE mysql.user SET Password = 'newpwd' WHERE Host = 'some_host' AND User = 'some_user';
FLUSH PRIVILEGES;

Premature end of data error with PHP

I had the same problem and fixed it using an UPDATE query like this:

UPDATE mysql.user SET Password = PASSWORD('newpwd') WHERE Host = 'some_host' AND User = 'some_user';

Don't know why but SET Password didn't work.

To be sure that the problem is the one i think you should do this query on the mysql database:

SELECT
`user`.`Password`
FROM
`user`
WHERE
`user`.`User` = 'youruser' AND
`user`.`Host` = 'yourhost'

if the password doesn't start with a * the problem is that you still have the old encription

EDIT _ Here is a php function to create valid password for MYSQL (taken from here):

function mysql_41_password($in)
{
$p=sha1($in,true);
$p=sha1($p);
return "*".strtoupper($p);
}

Thene you can set the password manually:

//newpwd is the passowr dgenerated in php
UPDATE mysql.user SET Password = 'newpwd' WHERE Host = 'some_host' AND User = 'some_user';
FLUSH PRIVILEGES;

XML Premature end of data

You have to close <Request> tag at the end.

Also it's not good to build XML by hand. Use DOMDocument class instead.

Error in xml file premature end of data in tag

You are missing a bunch of end tags. Load the file in a browser, and it will tell you the line number.

Below you will see the fixed xml:

<?xml version="1.0" encoding="UTF-8"?>
<list>
<banner id="1">
<image>http://lineagefree.com/acp/images/l2jbr.png</image>
<link>http://l2j.lt/topai/balsuoti-7907.php</link>
<votes>
<link>http://l2j.lt/topai/mokamas-7907.php</link>
<regexp><div class='list_8' style="font-weight: bold">(.*)</div></regexp>
</votes>
</banner>
<banner id="2">
<image>http://lineagefree.com/acp/images/top100mmorpg.png</image>
<link>http://l2j.lt/topai/balsuoti-7907.php</link>
<votes>
<link>http://l2j.lt/topai/mokamas-7907.php</link>
<regexp><div class='dlist_8' style="font-weight: bold">(.*)</div></regexp>
</votes>
</banner>
<banner id="3">
<image>http://lineagefree.com/acp/images/gamesitestop100.jpg</image>
<link>http://l2j.lt/topai/balsuoti-7907.php</link>
<votes>
<link>http://l2j.lt/topai/mokamas-7907.php</link>
<regexp><div class='dlist_8' style="font-weight: bold">(.*)</div></regexp>
</votes>
</banner>
<banner id="4">
<image>http://lineagefree.com/acp/images/arenatop100.png</image>
<link>http://l2j.lt/topai/balsuoti-7907.php</link>
<votes>
<link>http://l2j.lt/topai/mokamas-7907.php</link>
<regexp><div class='dlist_8' style="font-weight: bold">(.*)</div></regexp>
</votes>
</banner>
<banner id="5">
<image>http://lineagefree.com/acp/images/mmorpglist.jpg</image>
<link>http://l2j.lt/topai/balsuoti-7907.php</link>
<votes>
<link>http://l2j.lt/topai/mokamas-7907.php</link>
<regexp><div class='dlist_8' style="font-weight: bold">(.*)</div></regexp>
</votes>
</banner>
<banner id="6">
<image>http://lineagefree.com/acp/images/top200.gif</image>
<link>http://l2j.lt/topai/balsuoti-7907.php</link>
<votes>
<link>http://l2j.lt/topai/mokamas-7907.php</link>
<regexp><div class='dlist_8' style="font-weight: bold">(.*)</div></regexp>
</votes>
</banner>
</list>


Related Topics



Leave a reply



Submit