我已将我的项目从AWS迁移到Google Cloud。我之前有一个工作应用程序,但现在迁移到GCP后, mysqli_connect 似乎不再起作用。 到目前为止,我已经安装了以下内容:
我可以使用终端访问MySQL但无法使用PHP连接到远程数据库(在AWS RDS上)。 RDS数据库对IP连接没有任何限制,并向全世界开放。我已经尝试完全删除PHP,MySQL,MariaDB,但是没有成功。迁移后,连接到数据库的脚本保持不变。其他功能,如 mysqli_fetch_assoc 和 mysqli_query 不会引发任何错误。以下是 mysqld_log :
的内容170329 07:20:15 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
170329 07:31:09 mysqld_safe Logging to '/var/log/mysqld.log'.
170329 07:31:09 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
2017-03-29 07:31:09 0 [Warning] s deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-03-29 07:31:09 0 [Note] /usr/sbin/mysqld (mysqld 5.6.35) starting as process 32611 ...
2017-03-29 07:31:09 32611 [Warning] Buffered warning: Changed limits: max_open_files: 1024 (requested 5000)
2017-03-29 07:31:09 32611 [Warning] Buffered warning: Changed limits: table_open_cache: 431 (requested 2000)
2017-03-29 07:31:09 32611 [Note] Plugin 'FEDERATED' is disabled.
2017-03-29 07:31:09 32611 [Note] InnoDB: Using atomics to ref count buffer pool pages
2017-03-29 07:31:09 32611 [Note] InnoDB: The InnoDB memory heap is disabled
2017-03-29 07:31:09 32611 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-03-29 07:31:09 32611 [Note] InnoDB: Memory barrier is not used
2017-03-29 07:31:09 32611 [Note] InnoDB: Compressed tables use zlib 1.2.3
2017-03-29 07:31:09 32611 [Note] InnoDB: Using Linux native AIO
2017-03-29 07:31:09 32611 [Note] InnoDB: Using CPU crc32 instructions
2017-03-29 07:31:09 32611 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2017-03-29 07:31:09 32611 [Note] InnoDB: Completed initialization of buffer pool
2017-03-29 07:31:09 32611 [Note] InnoDB: Highest supported file format is Barracuda.
2017-03-29 07:31:09 32611 [Note] InnoDB: 128 rollback segment(s) are active.
2017-03-29 07:31:09 32611 [Note] InnoDB: Waiting for purge to start
2017-03-29 07:31:09 32611 [Note] InnoDB: 5.6.35 started; log sequence number 1626037
2017-03-29 07:31:09 32611 [Note] Server hostname (bind-address): '*'; port: 3306
2017-03-29 07:31:09 32611 [Note] IPv6 is available.
2017-03-29 07:31:09 32611 [Note] - '::' resolves to '::';
2017-03-29 07:31:09 32611 [Note] Server socket created on IP: '::'.
2017-03-29 07:31:09 32611 [Note] Event Scheduler: Loaded 0 events
2017-03-29 07:31:09 32611 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.6.35' socket: '/var/lib/mysql/mysql.sock' port: 3306 MySQL Community Server (GPL)
答案 0 :(得分:0)
你写的是你使用了mysqli_connect,但是你已经安装了php-mysql-5.4.16-42.el7.x86_64(注意:没有' i')。您需要mysqli的包才能连接PHP。