PHP无法在Amazon EC2微实例上运行MYSQLI函数

发布时间:2022-04-30 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了PHP无法在Amazon EC2微实例上运行MYSQLI函数脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
呃,我的亚马逊微实例遇到了一些麻烦.我刚刚实现了 PHP< - > MysqL界面.该实例似乎报告未安装MysqLI插件,但是,所有其他指示都是相反的.我已经厌倦了对搜索的耐心,现在将吸引整个互联网的更高智慧.谢谢你的期待!

我的代码

<?PHP
    error_reporting(E_ALL);
    ini_set('error_reporting',E_ALL);
    ini_set('display_errors','On');
    $MysqL = MysqLi_connect( 'localhost','EulerPHPUser','*********' );
    // more code

错误消息:致命错误:在第27行的/VAR/www/htML/euler/login.PHP调用未定义的函数MysqLi_connect()

$cat /etc/*-release
amazon Linux ami release 2013.03

这是我的PHP.ini文件的一部分

; Maximum number of links.  -1 means no limIT.
; http://www.PHP.net/manual/en/MysqLi.configuration.PHP#ini.MysqLi.max-links
MysqLi.max_links = -1

; Default port number for MysqLi_connect().  If unset,MysqLi_connect() will use
; the $MysqL_TCP_PORT or the MysqL-tcp entry in /etc/services or the
; compile-time value defined MysqL_PORT (in that order).  Win32 will only look
; at MysqL_PORT.
; http://www.PHP.net/manual/en/MysqLi.configuration.PHP#ini.MysqLi.default-port
MysqLi.default_port = 3306

; Default socket name for local MysqL connects.  If empty,uses the built-in
; MysqL defaults.
; http://www.PHP.net/manual/en/MysqLi.configuration.PHP#ini.MysqLi.default-socket
MysqLi.default_socket =

; Default host for MysqL_connect() (doesn't apply in safe mode).
; http://www.PHP.net/manual/en/MysqLi.configuration.PHP#ini.MysqLi.default-host
MysqLi.default_host =

; Default user for MysqL_connect() (doesn't apply in safe mode).
; http://www.PHP.net/manual/en/MysqLi.configuration.PHP#ini.MysqLi.default-user
MysqLi.default_user =

; Default password for MysqLi_connect() (doesn't apply in safe mode).
; Note that this is generally a *bad* idea to Store passwords in this file.
; *Any* user with PHP access can run 'echo get_CFg_var("MysqLi.default_pw")
; and reveal this password!  And of course,any users with read access to this
; file will be able to reveal the password as well.
; http://www.PHP.net/manual/en/MysqLi.configuration.PHP#ini.MysqLi.default-pw
MysqLi.default_pw =

; Allow or PRevent reconnect
MysqLi.reconnect = Off

这是PHPifo()的唯一部分,我搜索MysqLi产生了结果

Configure Command 
'./configure' '--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' '--target=x86_64-amazon-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' '--with-t1lib=/usr' '--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' '--with-kerberos' '--enable-ucd-snmp-hack' '--enable-shmop' '--enable-calendar' '--without-sqlite' '--with-libXMl-dir=/usr' '--enable-xml' '--with-system-tzdata' '--with-mhash' '--with-apxs2=/usr/sbin/apxs' '--libdir=/usr/lib64/PHP' '--enable-pdo=shared' '--with-MysqL=shared,/usr' '--with-MysqLi=shared,/usr/lib64/MysqL/MysqL_config' '--with-pdo-MysqL=shared,/usr/lib64/MysqL/MysqL_config' '--with-pdo-sqlite=shared,/usr' '--without-gd' '--disable-dom' '--disable-dba' '--without-unixODBC' '--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'

最后,还有一点需要注意.我试图运行以下代码,服务器返回一个完全空白的页面.没有错误,没有任何错误.好像PHP崩溃而没有产生错误.我不确定如何解释.

if (function_exists('MysqLi_connect')) {
     echo 'MysqLi is installed';
}

我甚至非常沮丧,我尝试了一些PDO,但后来得到错误连接失败:找不到驱动程序

如果有任何进一步的信息请告知我们,我会及时提供.感谢您的帮助

解决方法

在AWS中,我收到此错误,发现我需要运行“yum install PHP-MysqLi”.这是MysqLPHP包的补充.

脚本宝典总结

以上是脚本宝典为你收集整理的PHP无法在Amazon EC2微实例上运行MYSQLI函数全部内容,希望文章能够帮你解决PHP无法在Amazon EC2微实例上运行MYSQLI函数所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。