Pdo Installation for Mysql and other database

PHP PDO & MYsQL Pdo ( Portable Data Object ) needs to be installed if it is not done before. For windows platform go to control panel > Add remove program ( or Programs and features ) > Select your PHP installation and click Change. If you are installing PHP fresh then in the setup wizard you can select PDO from Extensions link.

PHP Data Object PDO installation or enable and creating connection string to manage MySQL database


PHP setup for PDO
Based on the database type you can enable or disable PDO drivers. Note that once you have done this process then automatically php.ini file gets edited and you may have to reboot your system. Note that PDO drivers are in your extension directory and in php.ini file this it to be enabled.
extension for PDO drivers
extension=php_pdo.dll
But in PHP 5.3 and above these dll are not required.
After installing pdo you can check your phpinfo function and ensure that PDO support is enabled.
PHP info page for PDO drivers

Checking PDO Installation

You can get all the PDO drivers installed in your system by using getAvailableDrivers() function. We will get an array with a list of drivers installed. Here is the code.
print_r(PDO::getAvailableDrivers());
We can check by using in_array function about any particular driver installed or not.
 if(in_array("mysql",PDO::getAvailableDrivers())){
echo " You have PDO for MySQL driver installed ";
 }else{
echo "PDO driver for MySQL is not installed in your system";
 }
Download Zip file to test your PHP PDO script

Questions



PDO References PDO database connection string
Subscribe to our YouTube Channel here


Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com







    Post your comments , suggestion , error , requirements etc here





    PHP video Tutorials
    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer