0
votes

We have a PHP 5.2 based app which we migrated to GCE, and encountered the problem where the Mysqli client does not work.

We used Atomic Archive repo to install PHP 5.2 on GCE 6 CentOS 6: http://www6.atomicorp.com/channels/atomic/centos/6/x86_64/RPMS/

and also installed the provided Mysql client: mysql-5.5.40-26.el6.art.x86_64.rpm

Following testing, the application fails with following error: Warning: mysqli::mysqli() [mysqli.mysqli]: (HY000/2003): Can't connect to MySQL server on XXX.XXX.XXX.XXX

While the command line mysql client works just fine.

While looking at the mysqli.so PHP extension, we noticed it uses the oldest available MySQL library: /usr/lib64/mysql/libmysqlclient.so.16

Any chance that this library doesn't work with Google Cloud SQL?

1
Are you by any chance specifying a definer? Or running your app with SUPER privileges? if so, Google Cloud SQL doesn't support SUPER privileges. is your GCE IP address in the authorized network on your Cloud SQL?George
It's a Drupal based application, and it gets only the standard CRUD privileges. By GCE, you mean the public or the internal address? That said, please note that the command line mysql client does connect normally.SyBer
The connection URL is fairly standard looking: $db_url = 'mysqli://USER:[email protected]/DB';SyBer

1 Answers

0
votes

This is how I connect from my php:

$conn = mysqli_connect("<IP>", "<username>", "<password>","database") or die ("Error" . mysqli_error($conn));