简体   繁体   English

如何配置php以启用pdo并在CentOS上包含mysqli?

[英]How do I configure php to enable pdo and include mysqli on CentOS?

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

Apparently my PHP installation was configured to exclude Mysqli and disable PDO for some reason. 显然我的PHP安装配置为排除Mysqli并因某些原因禁用PDO。 Therefore, I believe this is what's causing them to not work when I try to use the php command from the shell. 因此,我相信当我尝试使用shell中的php命令时,这就是导致它们无法工作的原因。 I can load mysqli and pdo via HTTP just fine, but they don't work from shell. 我可以通过HTTP加载mysqli和pdo就好了,但它们无法在shell中运行。 How do I enable these components and what are the risks in doing so? 如何启用这些组件以及这样做有哪些风险?

Configure Command: 配置命令:

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

Additional .ini files parsed: 解析了其他.ini文件:

/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

You might just have to install the packages. 您可能只需要安装软件包。

yum install php-pdo php-mysqli

After they're installed, restart Apache. 安装完成后,重新启动Apache。

httpd restart

or 要么

apachectl restart

mysqli is provided by php-mysql-5.3.3-40.el6_6.x86_64 mysqli由php-mysql-5.3.3-40.el6_6.x86_64提供

You may need to try the following 您可能需要尝试以下操作

yum install php-mysql-5.3.3-40.el6_6.x86_64

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM