How to enable PDO on AppServ on windows?

前端 未结 1 1228
粉色の甜心
粉色の甜心 2021-01-19 09:34

I am trying to create an app fir the first time using PDO and when i

try {
    $db = new PDO(\'mysql:host=localhost;dbname=DBname\', \'user\', \'pass\');
}          


        
相关标签:
1条回答
  • 2021-01-19 09:58

    Take a look into the PDO installation section of the PHP manual.

    It depends on the OS of your machine. If you compile php yourself, and you wish to install the MySQL PDO driver, then you should add the --with-pdo-mysql config option before compiling PHP.

    On a windows machine, just enable those two extensions...

    extension=php_pdo.dll <- only if below php 5.3
    extension=php_pdo_mysql.dll
    

    ...in your php.ini and restart your app server. The php.ini should usually be located in your php directory. Where it is located depends on where you've installed php.

    0 讨论(0)
提交回复
热议问题