Php web application can't process clearDB mysql service on bluemix -
i'm trying deploy php web application on bluemix. have bound cleardb mysql service application. vcap_service variable provided me. when use variable perform simple sql query, application page nothing, while same code doing xamp localhost. please me.
here code :
<?php $servername = "us-cdbr-iron-east-02.cleardb.net"; $username = "b23807********"; $password = "********"; $dbname = "ad_70723170af1****"; // create connection $conn = new mysqli($servername, $username, $password, $dbname); // check connection if ($conn->connect_error) { die("connection failed: " . $conn->connect_error); } // sql create table $sql = "create table flybird ( id int(6) unsigned auto_increment primary key, firstname varchar(30) not null, lastname varchar(30) not null, email varchar(50), reg_date timestamp )"; if ($conn->query($sql) === true) { echo "table flybird created successfully"; } else { echo "error creating table: " . $conn->error; } $conn->close(); ?>
the following error showing: got error 'php message: php fatal error: class 'mysqli' not found in /home/vcap/app/htdocs/table.php on line 8\n.
there issue php buildpack, need explicitly add mysqli function in application.
create file called .bp-config/options.json
. can customize php buildpack extensions, check this out more info.
the contents should contain following.
{ "php_extensions": ["mysqli"] }
Comments
Post a Comment