Page 1 of 1

PHP crashes in PDO::Query with latest xampp.

PostPosted: 23. December 2008 19:23
by rickh57
This morning, I upgraded to xampp version 1.7.0 for Windows (Vista). I have a lot of php scripts that use PDO to access the MySQL database. After the upgrade, apache crashes anytime that I execute $dbh->query(querystring). I've googled to see if I can get any clues, but without success. I've also searched the forums, but that still seems to be broken.

Here's the code:
Code: Select all
<!doctype html public "-//w3c//dtd html 3.2//en">
<html>

<body>

<?php
require_once "../../configdata/config.inc.php";
require_once "HTML/Table.php";

dbDemoPDO();

function dbDemoPDO($dbms="mysql") {
    try
    {
        $config = new Config();
        $limit = 50;
        $dbh = new PDO($config->buildPDODSN($dbms), $config->getUser(), $config->getPassword());
        echo("<h2>PDO Database API ($dbms DB)</h2>");

        $attributes = array("width"=>"80%", "border"=>"1");
        $table = new HTML_Table($attributes);

        $attributes = array("class"=>"chart");
        $table->addRow(array("City", "Population", "Country", "State"), $attributes, "TH");
        $query = "
SELECT city.Name, city.Population, country.Name, city.District
FROM city
INNER JOIN country ON city.CountryCode = country.Code
ORDER BY city.Population DESC LIMIT $limit
";
        echo "<p>query is $query</p>";
        /* Execute a selection query. */
        $cursor = NULL;
        // Uncommenting the following line causes Apache to crash...
        //$cursor = $dbh->query($query);
        foreach ($cursor as $row) {
            $name = $row[0];
            $population = $row[1];
            $country = $row[2];
            $state = $row[3];
            $contents = array($name,
                number_format($population),
                $country,
                $state);
            $table->addRow($contents, $attributes);
        }
        $table->setColAttributes(1,array("bgcolor"=>"#76A4D1","class"=>"chartnumber"));
        $table->setRowAttributes(0,array("bgcolor"=>"#FFFF84","class"=>"chart"));
        $attributes1 = "bgcolor = #76A4D1";
        $attributes2 = "bgcolor = #B6DCD5";
        $table->altRowAttributes(1, $attributes1, $attributes2);
        echo $table->toHTML();

        /* Disconnect from the database. */
        $dbh = NULL;
    }
    catch (Exception $e)
    {
        echo("<p>Exception occurred: " . $e->getMessage() . "</p>");
    }
}

?>

</body>
</html>

Re: PHP crashes in PDO::Query with latest xampp.

PostPosted: 25. December 2008 12:54
by lyntuan
Yes, this is a bug of Xampp 1.7

Re: PHP crashes in PDO::Query with latest xampp.

PostPosted: 25. December 2008 17:58
by Sharley
http://myblogit.net/2008/03/06/warning-ampstart-is-spyware/

Virus Alert on program Ampstart.exe

BUT NEVER EVER USE AMPSTART... IT'S FULL OF NASTY STUFF!!!

http://community.apachefriends.org/f/viewtopic.php?p=116988#p116988

TIP:
Always check and double check with a good quality file integrity scanner, or an online scanner suite, that your own download of any software is free from any kind of malware before running it on your PC.

Re: PHP crashes in PDO::Query with latest xampp.

PostPosted: 26. December 2008 10:44
by lyntuan
Please read Disclaimer section carefully before downloading.

Sharley wrote:http://myblogit.net/2008/03/06/warning-ampstart-is-spyware/

Virus Alert on program Ampstart.exe

BUT NEVER EVER USE AMPSTART... IT'S FULL OF NASTY STUFF!!!

http://community.apachefriends.org/f/viewtopic.php?p=116988#p116988

TIP:
Always check and double check with a good quality file integrity scanner, or an online scanner suite, that your own download of any software is free from any kind of malware before running it on your PC.

Re: PHP crashes in PDO::Query with latest xampp.

PostPosted: 31. December 2008 23:13
by a-patchy

Re: PHP crashes in PDO::Query with latest xampp.

PostPosted: 19. November 2009 16:38
by Newrone
lyntuan wrote:Please read Disclaimer section carefully before downloading.



Is that an answer? Sounds like a sidestep.

And is Ampstart now history?