Error ‘php.exe’ is not recognized as an internal or external command when calling phpunit on Windows XP/Vista/7

This may be caused by the PHP_PEAR_PHP_BIN environment variable not being set correctly.

To fix this go to Advanced System Settings in Control Panel/System & Maintenance/System.

Select Environment Variables.

Find variable PHP_PEAR_PHP_BIN and change the value from ./php.exe to the correct path\to\php.exe on your system.

References:
PHPUnit ignores pathing to php.exe on Windows for PHPT executions
php_pear_php_bin is not set correctly

Facebook Uses HipHop To Transform PHP to C++

On the Facebook Developers site, Haiping Zhao writes about how Facebook uses HipHop to transform PHP code to C++ and compiles them using g++. In his article titled, HipHop for PHP: Move Fast, he mentions:

HipHop for PHP isn’t technically a compiler itself. Rather it is a source code transformer. HipHop programmatically transforms your PHP source code into highly optimized C++ and then uses g++ to compile it. HipHop executes the source code in a semantically equivalent manner and sacrifices some rarely used features — such as eval() — in exchange for improved performance. HipHop includes a code transformer, a reimplementation of PHP’s runtime system, and a rewrite of many common PHP Extensions to take advantage of these performance optimizations.

In his article he describes how this tool helps to allow Facebook to scale to millions of users. He also mentions that HipHop has been released using the open source PHP license.

Cannot execute queries while other unbuffered queries are active

Cannot execute queries while other unbuffered queries are active

Can’t execute subsequent query after multiple queries from same Pdo_Mysql->exec() call

Can’t execute multiple stored procedures with Pdo_Mysql

Using the following code found in the Zend Framework Quickstart: Create a Model and Database Table

// this block executes the actual statements that were loaded from 
// the schema file.
try {
    $schemaSql = file_get_contents('./schema.sqlite.sql');
    // use the connection directly to load sql in batches
    $dbAdapter->getConnection()->exec($schemaSql);
    echo PHP_EOL;
    echo 'Database Created';
    echo PHP_EOL;

    if ($withData) {
        $dataSql = file_get_contents('./data.sqlite.sql');
        // use the connection directly to load sql in batches
        $dbAdapter->getConnection()->exec($dataSql);
        echo 'Data Loaded.';
        echo PHP_EOL;
    }

} catch (Exception $e) {
    echo 'AN ERROR HAS OCCURED:' . PHP_EOL;
    echo $e->getMessage() . PHP_EOL;
    return false;
}

Note that $dbAdapter->getConnection()->exec() gets called twice.

I encountered this issue when calling Pdo_Mysql->exec() or in the Zend Framework calling $dbAdapter->getConnection()->exec($schemaSql) one after the other.

One way to prevent the error was to call $dbAdapter->closeConnection() after each exec call. Another way I worked around this problem was to just execute the $schemaSql and the $dataSql in one exec call like below;

$schemaSql = file_get_contents('schema.sql', 1);
$dataSql = file_get_contents('data.sql', 1);
// use the connection directly to load sql in batches
$dbAdapter->getConnection()->exec($schemaSql . $dataSql);