PDO as the next PHP (as the current mainstream development language) database unified interface, the current version is 0.9, it seems soon to release, early adopters.
After testing, PDO coupling is about 3 times times faster than ADODB, and the direct connection is very small.
Test tool: AB
Test conditions Apache (the most popular Web server platform for UNIX platforms)/2.0.54 (Debian gnu/linux) mod_fastcgi (now not many people are using)/2.4.2 PHP (as the current mainstream development language)/5.0.4-0.10 mod_perl/2.0.1 perl/v5.8.7 Server at 127.0.0.1 Port 80
Database: postgres8.0.3
Hardware: c4-1.7g;384m
Installing PDO requires PHP (which is now the mainstream development language) as well as gccg++, and of course PHP (which is now the mainstream development language) (as the current mainstream development language) 5-dev
Install Pdo_pgsql need Libpg-dev above software must apt-get otherwise will fail!!!
#>pear Remote-info PDO
Pear Remote-info PDO
notice:undefined Index:name in remote.php (as the current mainstream development language) on line 132
notice:undefined index:version in remote.php (as the current mainstream development language) on line 133
notice:undefined Index:name in cli.php (as the current mainstream development language) on line 443
notice:undefined Index:license in cli.php (as the current mainstream development language) on line 444
notice:undefined index:category in cli.php (as the current mainstream development language) on line 445
notice:undefined index:summary in cli.php (as the current mainstream development language) on line 446
notice:undefined index:description in cli.php (as the current mainstream development language) on line 447
Package Details:
================
Latest
Installed-no-
Package
License
Category
Summary
Description
Ha, still do not know the version is good, to http://pecl.php (as the mainstream development language now). net/Search, current version 0.9
Ok
# "Pear Install pdo-0.9
Pear will install it for you.
The compiled modules are placed in:/usr/lib/php (as the current mainstream development language) under the 5/20041030/directory
#>cd/usr/lib/php (as the current mainstream development language) 5/20041030/
Note: The Debian system PHP (as the current mainstream development language) external module requires two files to be started, one is the pdo.so we just compiled
Also require a pdo.info file
If you don't write it, fry the following:
Package= "PDO"
Extname= "PDO"
Dsoname= "PDO"
sapilist= "Apache (Unix platform most popular Web server platform) Apache (Unix platform most popular Web server platform) 2 CGI (now no more people are using) CLI fcgi (now no more people are using)"
Depends= ""
Priority= "500"
Architecture= "any"
Then run:
#/usr/sbin/php (as the current mainstream development language) 5-modconf Apache (the most popular Web server platform for UNIX platforms) 2
The system will prompt you for which modules you need, check PDO to determine
The PDO is installed successfully.
Install pdo_pgsql-0.9 below
This needs to be done as follows:
# "Pear Download pdo_pgsql-0.9
#> Tar zxf pdo_pgsql-0.9.tgz
#>cd pdo_pgsql-0.9
#>php (as the current mainstream development language) ize
#>./configure
#>make
#>make Install
Then repeat the process of installing PDO above: Modify Pdo_pgsql.info
Package= "Pdo_pgsql"
Extname= "Pdo_pgsql"
Dsoname= "Pdo_pgsql"
sapilist= "Apache (Unix platform most popular Web server platform) Apache (Unix platform most popular Web server platform) 2 CGI (now no more people are using) CLI fcgi (now no more people are using)"
Depends= ""
Priority= "500"
Architecture= "any"
Run
#/usr/sbin/php (as the current mainstream development language) 5-modconf Apache (the most popular Web server platform for UNIX platforms) 2
Select the Pdo_pgsql module
OK, everything's ready.
# Apache (the most popular Web server platform on UNIX platforms) 2-k restart
To edit a test module:
Connect to an ODBC database using driver invocation
$host =xxxx.xxxx.com;
$port = 5433;
$dbname =test;
$user =xxxxxx;
$password =xxxxxxxx;
$CC = "host= $host, Dbname= $dbname, port= $port";
$DSN = "pgsql:host= $host port= $port dbname= $dbname user= $user password= $password";
try {
$DBH = new PDO ($DSN, $user, $password);
} catch (Pdoexception $e) {
Echo Connection failed:. $e->getmessage ();
}
$sql =select * from CPJCSJ;
foreach ($dbh->query ($sql) as $row) {
Print $row [CPDM]. "";
Print $row [CPDH]. "";
Print $row [CPMC]. "";
}
?>
OK, enter http://localhost/pdotest.php on your browser (as the current mainstream development language)
Did you see the data in your database?
Congratulations to you!!!
http://www.bkjia.com/PHPjc/508729.html www.bkjia.com true http://www.bkjia.com/PHPjc/508729.html techarticle PDO as the next PHP (as the current mainstream development language) database unified interface, the current version is 0.9, it seems soon to release, early adopters. After testing, PDO Junction ...