4/29/2008

Zend Studio does not contain PDO extensions

I've just installed Zend Studio 6 and Zend ZendFramework-1.5 onto my Ubuntu 8. It already has Apache 2.0 and MySQL 5.0 and PHP 5.2.1 running.

I used PHPunit to test My class extended from Zend_db_Table, but I can not run it normally!

Result :
when I tried to run the script inside the Zend Studio. It gave me this error
"Debug Error: /media/sda5/workspace/library/Zend/Db/Adapter/Pdo/Abstract.php line 104 - Uncaught exception 'Zend_Db_Adapter_Exception' with message 'The mysql driver is not currently installed' in /media/sda5/workspace/library/Zend/Db/Adapter/Pdo/Abstract.php:104
Stack trace:
#0 /media/sda5/workspace/library/Zend/Db/Adapter/Abstract.php(390): Zend_Db_Adapter_Pdo_Abstract->_connect()
#1 /media/sda5/workspace/library/Zend/Db/Adapter/Pdo/Abstract.php(206): Zend_Db_Adapter_Abstract->query('SET NAMES utf8', Array)
#2 /media/sda5/workspace/coojs/test/DataAdapter.php(7): Zend_Db_Adapter_Pdo_Abstract->query('SET NAMES utf8')
#3 /media/sda5/workspace/coojs/test/models/User/Data/User_Data_TableTest.php(6): require_once('/media/sda5/wor...')
#4 /usr/local/Zend/ZendStudioForEclipse-6.0.0/plugins/com.zend.php.phpunit_6.0.0.v20080107/resources/ZendPHPUnit.php(65): require_once('/media/sda5/wor...')
#5 {main}
thrown
Well ,this is the problem! how to resolve this problem?


the resolving method is:

1 set the adapter type to phpmysqli

[code]

/** * This is the PHP (No pdo) way. Please notice the PHP_MYSQL */

require_once 'Zend.php';

require_once 'Zend/Db.php';

$config = array( 'host'
=> 'localhost', 'username' => 'sqluser', 'password' => 'sqlpass',
'dbname' => 'databasename',);

$db = Zend_Db::factory('Mysqli', $config); //Is the adapter be PHP_Mysql?

2 To add a PHP executable to the list in IDE: I used the PHP CGI in ZendCore

3 Anything will oK! the test is run successful!



No comments: