如何在Windows的AppServ上启用PDO? [英] How to enable PDO on AppServ on windows?

查看:186
本文介绍了如何在Windows的AppServ上启用PDO?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正试图在第一次使用PDO以及当我

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');
} catch(PDOException $e){
    echo '<div class="errorMSG">Failed to connect to database. Please try to refresh this page in 1 minute. However, if you continue to see this message please contact your system administrator.</div>';
    echo '<br /><br />' . $e->getMessage();
    exit();

}

当然,我已经将一次传递用户名和DBname更改为正确的一次,但是我得到了一个错误 找不到驱动程序

ofcourse i have change pass user and DBname to the correct once but i have get an error could not find driver

因此,通过很少的搜索,我发现我需要启用pdo_mysql,但似乎无法找出在哪里以及如何执行? 有人可以帮助我如何启用此功能和/或使它在我的本地计算机上运行.我有Windows 7. 我找不到我的php.int所在的位置.

So with few searches i found out that i need to enable pdo_mysql but i can't seems to find out where do I do that and how? Can some one please help me with how to enable this and/or get this to work on my local machine. I have windows 7. I can't find where is my php.int is located.

谢谢:)

推荐答案

看看.

这取决于计算机的操作系统.如果您自己编译php,并且希望安装MySQL PDO驱动程序,则应添加 --with-pdo-mysql 配置选项,然后编译PHP.

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.

在Windows计算机上,只需启用这两个扩展...

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

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

中的

...,然后重新启动应用程序服务器. php.ini通常应该位于您的php目录中.它的位置取决于您安装php的位置.

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

这篇关于如何在Windows的AppServ上启用PDO?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆