PHP无法在Amazon EC2微型实例上运行MYSQLI函数 [英] PHP unable to run MYSQLI functions on Amazon EC2 micro instance

查看:72
本文介绍了PHP无法在Amazon EC2微型实例上运行MYSQLI函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

呃,我的Amazon微型实例遇到了一些真正的麻烦.我现在正在实现PHP<-> MYSQL接口.该实例似乎在报告未安装MYSQLI插件,但是所有其他指示均相反.我已经对搜索失去了耐心,现在将吸引整个互联网的更高智能.感谢您的光临!

Ugh, I'm running into some real trouble with my Amazon micro instance. I'm just now implementing a PHP <-> MYSQL interface. The instance seems to be reporting that the MYSQLI plugin is not installed, however, all other indications are contrary. I've exhausted my patience with searching and will now appeal to the higher intellect of the internet as a whole. Thanks for looking!

我的代码:

<?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文件的一部分

Here's the portion of my php.ini file

; 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会产生结果

This is the only section of the phpifo() where my search for mysqli yielded results

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崩溃而没有产生错误.我不确定如何解释.

Finally, one other thing to note. I tried to run the following code, and the server returns a completely blank page back. No errors, no nothing. As if php crashed without generating an error. I'm not sure how to interpret that.

if (function_exists('mysqli_connect')) {
     echo 'mysqli is installed';
} 

我什至感到沮丧,以至于尝试了一些PDO,但随后出现错误连接失败:找不到驱动程序

I even got so frustrated that I tried some PDO, but then got error Connection failed: could not find driver

请告知是否需要进一步的信息,我会尽快提供.谢谢您的帮助

Please advise if any further info is requested and I'll promptly provide it. Thank you for the help

推荐答案

在AWS中,出现此错误,发现我需要运行"yum install php-mysqli".这是除mysql和php软件包之外的内容.

In AWS, I got this error and found that I needed to run "yum install php-mysqli". This is in addition to the mysql and php packages.

这篇关于PHP无法在Amazon EC2微型实例上运行MYSQLI函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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