Pdo serves as the unified database interface for the next php (as the mainstream development language). The current version is 0.9. It seems that the release will soon be ready to use.
After tests, pdo connections are about three times faster than adodb connections, and the difference between pdo connections and direct connections is very small.
Test Tool: AB
Test Conditions: apache (the most popular WEB server platform on Unix)/2.0.54 (Debian GNU/Linux) mod_fastcgi (not many people are using it now) /2.4.2 php (as the 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: ipvs8.0.3
Hardware: C4-1.7g; 384 M
To install pdo, you need php (as the mainstream development language) Development Kit and gccg ++. Of course, you also need php (as the mainstream development language) php (as the mainstream development language) 5-dev
To install PDO_pgsql, libpg-dev or above must be apt-get or else it will fail !!!
#> Pear remote-info pdo
Pear remote-info pdo
Notice: Undefined index: name in Remote. php (as the mainstream development language) on line 132
Notice: Undefined index: version in Remote. php (as a mainstream development language) on line 133
Notice: Undefined index: name in CLI. php (as a mainstream development language) on line 443
Notice: Undefined index: license in CLI. php (as the mainstream development language) on line 444
Notice: Undefined index: category in CLI. php (as the mainstream development language) on line 445
Notice: Undefined index: summary in CLI. php (as a mainstream development language) on line 446
Notice: Undefined index: description in CLI. php (as the mainstream development language) on line 447
Package details:
======================
Latest
Installed-no-
Package
License
Category
Summary
Description
Ha, or do not know the version is good, to the http://pecl.php (as the current mainstream development language). net/search, the current version of 0.9
OK
# Pear install pdo-0.9
Pear will help you install
The compiled modules are stored in:/usr/lib/php (as the mainstream development language) 5/20041030/directory.
#> Cd/usr/lib/php (as the mainstream development language) 5/20041030/
Note: The debian system's php (as the mainstream development language) External module requires two files to be started, one is the newly compiled pdo. so
You also need a pdo.info file.
If you do not want to write it, click the following:
Package = "pdo"
Extname = "PDO"
Dsoname = "pdo"
Sapilist = "apache (the most popular WEB server platform on the Unix platform) 2 cgi (not many people are using it now) fccli GI (not many people are using it now )"
Depends = ""
Priority = "500"
Architecture = "any"
Then run:
# "/Usr/sbin/php (as the mainstream development language) 5-modconf apache (the most popular WEB server platform on the Unix platform) 2
The system will prompt you which modules you need and select pdo to confirm
The pdo is successfully installed.
Install pdo_pgsql-0.9 below
Follow these steps:
# Pear download pdo_pgsql-0.9
#> Tar zxf PDO_PGSQL-0.9.tgz
#> Cd PDO_PGSQL-0.9
#> Php (as the mainstream development language) ize
#>./Configure
#> Make
#> Make install
Repeat the above installation process: Modify pdo_pgsql.info
Package = "pdo_pgsql"
Extname = "PDO_PGSQL"
Dsoname = "pdo_pgsql"
Sapilist = "apache (the most popular WEB server platform on the Unix platform) 2 cgi (not many people are using it now) fccli GI (not many people are using it now )"
Depends = ""
Priority = "500"
Architecture = "any"
Run
# "/Usr/sbin/php (as the mainstream development language) 5-modconf apache (the most popular WEB server platform on the Unix platform) 2
Select pdo_pgsql Module
OK. Everything is ready.
# Apache (the most popular WEB server platform on Unix) 2-k restart
Edit the 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]. "";
}
?>
Now, enter http: // localhost/pdotest. php in your browser (as the mainstream development language)
Have you seen the data in your database?
Congratulations !!!