在MySQL Linux服务器上安装PDO驱动程序 [英] Installing PDO driver on MySQL Linux server

查看:180
本文介绍了在MySQL Linux服务器上安装PDO驱动程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

不久前,有人建议我更改代码以使用PDO,以便参数化查询并安全地将HTML保存在数据库中.

I was suggested, not long ago, to change my code to use PDO in order to parameterize my queries and safely save HTML in the database.

好吧,这是主要问题:

  1. 我查看了 http://php.net/manual/zh_cn/ref.pdo-mysql.php ,但我并没有真正知道应在何处放置$ ./configure --with-pdo-mysql字符串...

  1. I looked at http://php.net/manual/en/ref.pdo-mysql.php, and I don't really get where I should put that $ ./configure --with-pdo-mysql string...

我正在构建的网站实际上只需要一页PDO.虽然我可能会考虑重写它,但是这需要一段时间,并且我需要页面尽快运行,因此无法完全关闭MySQL.如果我确实安装了PDO,我仍然可以使用mysql_*处理程序吗?

The site I'm building actually only requires PDO for one page. While I may consider re-writing it, it would take a while and I need the pages to be running soon, so I can't turn off MySQL completely. If I do install PDO, will I still be able to use mysql_* handlers?

有问题的服务器正在运行PHP版本5.4.6-1ubuntu1和Apache/2.2.22(Ubuntu).如果重要的话,我也正在运行phpMyAdmin数据库.

The server in question is running PHP Version 5.4.6-1ubuntu1 and Apache/2.2.22 (Ubuntu). I'm also running a phpMyAdmin database, if it matters.

推荐答案

在Ubuntu上,您应该能够使用sudo apt-get install php5-mysql

On Ubuntu you should be able to install the necessary PDO parts from apt using sudo apt-get install php5-mysql

同时使用PDO和mysql_没有限制.但是,您将需要创建到数据库的两个连接,一个使用mysql_,另一个使用PDO.

There is no limitation between using PDO and mysql_ simultaneously. You will however need to create two connections to your DB, one with mysql_ and one using PDO.

这篇关于在MySQL Linux服务器上安装PDO驱动程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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