Activating PHP Extensions on Bluemix

This is a pure Bluemix question!

My code works fine on the local host, but when I transferred it to Bluemix, my connection to the database turned out to be unsuccessful. When checking the logs, I found the problem "Calling the undefined function mysqli_init ()" the HTTP response is 500. I found out that the extension was disabled to reduce it and found some information about it: Build options .

Unfortunately, I tried this and could not. Perhaps I misunderstood the solution.

Screen shot

Any help would be greatly appreciated.

EDIT:

bgconfig -> bp-config solves "undefined function error"

Some extension seems to be added, but not all. "Fatal error:" PDO "class not found in / home / vcap / app / htdocs / db _config.php on line 15"

However, I added the PDO extension to options.json.

I tried adding php.ini rewrite Screen shot

But still get the same error ...

For information: line 15 on db_config.php is simple:

$db = new PDO('mysql:host=us-cdbr-iron-east-02.cleardb.net;dbname=ad_dae231843a962ca', $username, $password);}

inside try and catch, of course.

Any clues?

+4
source share
4 answers

The file options.jsonis specified correctly. However, it is located in the wrong directory, it must be in the folder with the name .bp-config/. Renamed the folder and canceled the application back to Bluemix.

Also try adding pdo_mysqlin .bp-config/options.json.

I just checked some code with PDO driver against DB and it worked fine. My .bp-config/options.jsonfile is below.

{
    "PHP_EXTENSIONS": ["pdo", "mysqli", "pdo_mysql", "mysql"]
}

MySQL. .

PDO.

+6

options.json , . , , options.json, .bgconfig, .bp-config.

, Bluemix, .

0

mysql, composer.json?

{
  "require": {
    "ext-mysqli": "*"
  }
}

https://github.com/IBM-Bluemix/php-mysql

-1

composer.json

{
  "require": {
    "ext-mysqli": "*",
    "ext-gd": "*"
  }
}
-1

All Articles