Full Learning PHP PDO installation using _php tutorial

Source: Internet
Author: User
With the rapid development of PHP, its function is also more and more powerful, PDO (PHP Data Object) is the new PHP 5, when PHP 6 is out, PHP 6 only by default using PDO to process the database, will all the database extension moved to the PECL, Then the default is not our favorite php_mysql.dll, what to do pinch, we only with the times, I have tried a small PDO. (This article is only entry-level, master can skip, hehe)

What is PHP PDO?

PDO is a significant feature of new PHP 5, since php4/php3 before PHP 5 is a bunch of database extensions to connect and process with each database, what Php_mysql.dll, Php_pgsql.dll, Php_mssql.dll, Php_ Sqlite.dll and so on extension to connect MySQL, PostgreSQL, MS SQL Server, SQLite, similarly, we have to use ADOdb, PEAR::D B, Phplib::D B, such as database abstract class to help us, extremely cumbersome and inefficient , after all, how efficient is the PHP code that we write directly in C + + with the extended slope high pinch? So, the appearance of PDO is inevitable, we have to calm learning attitude to accept the use, perhaps you will find that you can reduce a lot of kung fu Oh.

Installing PHP PDO

I am on Windows XP SP2 above, so, the whole process is on the Windows line, as for the LINUX/FREEBSD platform, please find the data set installation.
My is PHP 5.1.4, already has the extension of the Php_pdo.dll, but need a little set up to use.

Open C:windowsphp.ini, that is my php config file, find the following line:

 
  
  

This is the directory where our extension exists, and my PHP 5 extension is in: C:php5ext, then I will change this line to:

 
  
  
  1. Extension_dir"C:/php5/ext"

Then go to php.ini below to find:

 
  
  


Here's a bunch of things like, Extension=php_mbstring.dll, here's the PHP extension load configuration, and we'll add our PDO extensions on the last side:

 
 
  1. extension = Php_pdo . DLL
  2. extension = Php_pdo_mysql . DLL
  3. extension = Php_pdo_pgsql . DLL
  4. extension = Php_pdo_sqlite . DLL
  5. extension = Php_pdo_mssql . DLL
  6. extension = Php_pdo_odbc . DLL
  7. extension = Php_pdo_firebird . DLL
  8. ; extension = Php_pdo_oci8 . DLL

A variety of PHP PDO driver, can give a full add, but the back of the Php_pdo_oci8.dll, because I did not install the Oralce database, so without this, use semicolons to comment out it. Then restart our web server, Iis/apache, my is IIS, hehe, table despise me, on windows, simple.

After rebooting, write a phpinfo.php file in our Web server's documentation directory, plus these:

 
  
  
  1. ?
  2. Phpinfo ();

Then open our lovely browser: Ie/firefox, my is FireFox 2.0, just download, very cool, not afraid of rogue software, haha. Enter in the browser: http://localhost/phpinfo.php, if your page path is inconsistent, please enter it yourself. The output of the content, if you can see smoothly:

 
  
  
  1. Pdo
  2. PDO Support Enabled

There are a variety of driver instructions at the back: Pdo_firebird,pdo_mssql,pdo_mysql,pdo_odbc,pdo_pgsql,pdo_sqlite well, congratulations on your installation, otherwise please check the above steps carefully.


http://www.bkjia.com/PHPjc/446458.html www.bkjia.com true http://www.bkjia.com/PHPjc/446458.html techarticle with the rapid development of PHP, its function is also more and more powerful, PDO (PHP Data Object) is the new PHP 5, when PHP 6 to come out, PHP 6 only by default using PDO to process the database ...

  • 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.