PHP crashes in PDO::Query with latest xampp.

Problems with the Windows version of XAMPP, questions, comments, and anything related.

PHP crashes in PDO::Query with latest xampp.

Postby rickh57 » 23. December 2008 19:23

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>
rickh57
 
Posts: 25
Joined: 28. April 2005 17:12

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

Postby lyntuan » 25. December 2008 12:54

Yes, this is a bug of Xampp 1.7
AMPstart :: Launch a Portable Web Server
http://ampstart.com
----------------------------------------------------------
Please read Disclaimer section carefully before downloading
lyntuan
 
Posts: 104
Joined: 08. November 2006 00:21

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

Postby Sharley » 25. December 2008 17:58

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.
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

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

Postby lyntuan » 26. December 2008 10:44

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.
AMPstart :: Launch a Portable Web Server
http://ampstart.com
----------------------------------------------------------
Please read Disclaimer section carefully before downloading
lyntuan
 
Posts: 104
Joined: 08. November 2006 00:21

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

Postby a-patchy » 31. December 2008 23:13

a-patchy
 
Posts: 5
Joined: 31. December 2008 22:55

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

Postby Newrone » 19. November 2009 16:38

lyntuan wrote:Please read Disclaimer section carefully before downloading.



Is that an answer? Sounds like a sidestep.

And is Ampstart now history?
Newrone
 
Posts: 9
Joined: 24. June 2007 03:47


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 124 guests