Install the pdo module for PHP5.0.3 in debian

Source: Internet
Author: User
Pdo is the next unified php database interface. The current version is 0.9. it seems that the release will soon be ready for early adopters. 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 condition Apache2.0.54 (DebianGNUlinux) mod_fastcgi2.4.2PHP5.0.4-0.10mod_perl2.0.1Pe pdo as the next php database unified interface, the current version is 0.9, it seems that soon can release, preemptive taste.
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/2.0.54 (Debian GNU/linux) mod_fastcgi/2.4.2 PHP/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
Install pdo need php development kit and gcc \ g ++, of course, also need php php5-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 on line 132

Notice: Undefined index: version in Remote. php on line 133

Notice: Undefined index: name in CLI. php on line 443

Notice: Undefined index: license in CLI. php on line 444

Notice: Undefined index: category in CLI. php on line 445

Notice: Undefined index: summary in CLI. php on line 446

Notice: Undefined index: description in CLI. php on line 447
Package details:
======================
Latest
Installed-no-
Package
License
Category
Summary
Description
Ha, I still don't know the version. go to http://pecl.php.net/sousuo. Currently, the version is 0.9.
OK
# Pear install pdo-0.9
Pear will help you install
The compiled modules are stored in the directory/usr/lib/php5/20041030 /.
#> Cd/usr/lib/php5/20041030/
Note: The php external module of the debian system requires two files to be started. one is the newly compiled pdo. so file.
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 apache2 cgi cli fcgi"
Depends = ""
PRiority = "500"
Architecture = "any"
Then run:
#/Usr/sbin/php5-modconf apache2
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
#> Phpize
#>./Configure
#> Make
#> Make install
Repeat the above installation process: modify pdo_pgsql.info
Package = "pdo_pgsql"
Extname = "PDO_PGSQL"
Dsoname = "pdo_pgsql"
Sapilist = "apache apache2 cgi cli fcgi"
Depends = ""
Priority = "500"
Architecture = "any"
Run
#/Usr/sbin/php5-modconf apache2
Select pdo_pgsql module
OK. everything is ready.
# Apache2-k restart
Edit the test module:

// Connect to an ODBC database using driver invocation

$ Host = 'xxxx .xxxx.com ';
$ Port = '000000 ';
$ 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 ']. "\ t ";
Print $ row ['cpdh']. "\ t ";
Print $ row ['cpmc ']. "\ n ";
}

?>

Okay, enter http: // localhost/pdotest. php in your browser.
Have you seen the data in your database?
Congratulations !!!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.