如何配置 php 以在 CentOS 上启用 pdo 并包含 mysqli? [英] How do I configure php to enable pdo and include mysqli on CentOS?

查看:16
本文介绍了如何配置 php 以在 CentOS 上启用 pdo 并包含 mysqli?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

CentOS 上的 PHP 版本 5.3.3(x86_64,RHEL 6)

PHP Version 5.3.3 on CentOS (x86_64, RHEL 6)

显然我的 PHP 安装被配置为排除 Mysqli 并出于某种原因禁用 PDO.因此,我相信当我尝试从 shell 使用 php 命令时,这就是导致它们无法工作的原因.我可以很好地通过 HTTP 加载 mysqli 和 pdo,但它们不能从 shell 工作.如何启用这些组件?这样做有什么风险?

Apparently my PHP installation was configured to exclude Mysqli and disable PDO for some reason. Therefore, I believe this is what's causing them to not work when I try to use the php command from the shell. I can load mysqli and pdo via HTTP just fine, but they don't work from shell. How do I enable these components and what are the risks in doing so?

配置命令:

'./configure' '--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' '--target=x86_64-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/var/lib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--cache-file=../config.cache' '--with-libdir=lib64' '--with-config-file-path=/etc' '--with-config-file-scan-dir=/etc/php.d' '--disable-debug' '--with-pic' '--disable-rpath' '--without-pear' '--with-bz2' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--with-xpm-dir=/usr' '--enable-gd-native-ttf' '--without-gdbm' '--with-gettext' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-pcre-regex=/usr' '--with-zlib' '--with-layout=GNU' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--with-kerberos' '--enable-ucd-snmp-hack' '--enable-shmop' '--enable-calendar' '--without-sqlite' '--with-libxml-dir=/usr' '--enable-xml' '--with-system-tzdata' '--with-apxs2=/usr/sbin/apxs' '--without-mysql' '--without-gd' '--disable-dom' '--disable-dba' '--without-unixODBC' '--disable-pdo' '--disable-xmlreader' '--disable-xmlwriter' '--without-sqlite3' '--disable-phar' '--disable-fileinfo' '--disable-json' '--without-pspell' '--disable-wddx' '--without-curl' '--disable-posix' '--disable-sysvmsg' '--disable-sysvshm' '--disable-sysvsem' 

解析的其他 .ini 文件:

Additional .ini files parsed:

/etc/php.d/apc.ini, /etc/php.d/bcmath.ini, /etc/php.d/curl.ini, /etc/php.d/dba.ini, /etc/php.d/dom.ini, /etc/php.d/fileinfo.ini, /etc/php.d/gd.ini, /etc/php.d/imap.ini, /etc/php.d/json.ini, /etc/php.d/ldap.ini, /etc/php.d/mbstring.ini, /etc/php.d/mcrypt.ini, /etc/php.d/mysql.ini, /etc/php.d/mysqli.ini, /etc/php.d/odbc.ini, /etc/php.d/pdo.ini, /etc/php.d/pdo_mysql.ini, /etc/php.d/pdo_odbc.ini, /etc/php.d/pdo_sqlite.ini, /etc/php.d/phar.ini, /etc/php.d/snmp.ini, /etc/php.d/soap.ini, /etc/php.d/sqlite3.ini, /etc/php.d/wddx.ini, /etc/php.d/xmlreader.ini, /etc/php.d/xmlrpc.ini, /etc/php.d/xmlwriter.ini, /etc/php.d/xsl.ini, /etc/php.d/zip.ini 

/etc/php.ini

/etc/php.ini

extension=pdo.so
extension=pdo_mysql.so
extension=pdo_sqlite.so
extension=mysql.so

推荐答案

你可能只需要安装包.

yum install php-pdo php-mysqli

安装完成后,重新启动 Apache.

After they're installed, restart Apache.

httpd restart

apachectl restart

这篇关于如何配置 php 以在 CentOS 上启用 pdo 并包含 mysqli?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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