在这个 php 配置中是否启用了 mysqli 扩展?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6285141/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 23:54:17  来源:igfitidea点击:

Is mysqli extension enabled in this php configuration?

phpmysqli

提问by arun nair

I've a website designed in php with mysqli (mysql - improved) extension. The phpinfo() page shows this:

我有一个用 php 设计的网站,带有 mysqli(mysql - 改进)扩展。phpinfo() 页面显示:

./configure --disable-fileinfo --disable-phar --enable-bcmath --enable-calendar --enable-ftp --enable-gd-native-ttf --enable-libxml --enable-magic-quotes --enable-mbstring --enable-pdo=shared --enable-soap --enable-sockets --enable-wddx --enable-zend-multibyte --enable-zip --prefix=/usr --with-bz2 --with-curl=/opt/curlssl/ --with-curlwrappers --with-freetype-dir=/usr --with-gd --with-imap=/opt/php_with_imap_client/ --with-imap-ssl=/usr --with-jpeg-dir=/usr --with-kerberos --with-libdir=lib64 --with-libexpat-dir=/usr --with-libxml-dir=/opt/xml2 --with-libxml-dir=/opt/xml2/ --with-mcrypt=/opt/libmcrypt/ --with-mysql=/usr --with-mysql-sock=/var/lib/mysql/mysql.sock --with-mysqli=/usr/bin/mysql_config --with-openssl=/usr --with-openssl-dir=/usr --with-pcre-regex=/opt/pcre --with-pdo-mysql=shared --with-pdo-sqlite=shared --with-pic --with-png-dir=/usr --with-pspell --with-sqlite=shared --with-tidy=/opt/tidy/ --with-xmlrpc --with-xpm-dir=/usr --with-xsl=/opt/xslt/ --with-zlib --with-zlib-dir=/usr

./configure --disable-fileinfo --disable-phar --enable-bcmath --enable-calendar --enable-ftp --enable-gd-native-ttf --enable-libxml --enable-magic-quotes - -enable-mbstring --enable-pdo=shared --enable-soap --enable-sockets --enable-wddx --enable-zend-multibyte --enable-zip --prefix=/usr --with-bz2 - -with-curl=/opt/curlssl/ --with-curlwrappers --with-freetype-dir=/usr --with-gd --with-imap=/opt/php_with_imap_client/ --with-imap-ssl=/ usr --with-jpeg-dir=/usr --with-kerberos --with-libdir=lib64 --with-libexpat-dir=/usr --with-libxml-dir=/opt/xml2 --with-libxml -dir=/opt/xml2/ --with-mcrypt=/opt/libmcrypt/ --with-mysql=/usr --with-mysql-sock=/var/lib/mysql/mysql.袜子 --with-mysqli=/usr/bin/mysql_config --with-openssl=/usr --with-openssl-dir=/usr --with-pcre-regex=/opt/pcre --with-pdo-mysql =shared --with-pdo-sqlite=shared --with-pic --with-png-dir=/usr --with-pspell --with-sqlite=shared --with-tidy=/opt/tidy/ - -with-xmlrpc --with-xpm-dir=/usr --with-xsl=/opt/xslt/ --with-zlib --with-zlib-dir=/usr

Does this mean that mysqli extension is enabled in this configuration?

这是否意味着在此配置中启用了 mysqli 扩展?

回答by mario

Should the mysqliextension be enabled then on the very same phpinfopage a "MysqlI Support | enabled" table header should appear. Look for that:

如果mysqli扩展被启用,那么在同一个phpinfo页面上应该会出现一个“ MysqlI Support | enabled”表头。寻找那个:

enter image description here

在此处输入图片说明



If you want to find out in a script, look for a function specific for mysqli like mysqli_connect()and than check if it exists:

如果您想在脚本中查找,请查找特定于 mysqli 的函数,mysqli_connect()然后检查它是否存在:

var_dump(function_exists('mysqli_connect'));

If this outputs FALSE, then it does not exists and it's highly likely that you can not use the module.

如果输出 FALSE,则它不存在,并且您很可能无法使用该模块。

回答by John Cartwright

It means it was compiled with mysqli support. Whether the module is enabled or not is another question.

这意味着它是用 mysqli 支持编译的。是否启用模块是另一个问题。