Search code examples
phpmysqldatabaseibm-cloud

How to connect MySQl using php on IBM Bluemix?


I am install service MySQL to my PHP app on Bluemix and the error is on connection establish on this lines:

$con = mysql_connect("192.155.247.248:3307","uqDqUZ2EKoZ5I","pWXeBZbNtdpOv"); 
if (!$con){ 
    echo "Failed to connect to MySQL: " .mysql_error(); 
} 
mysql_select_db("d65a2b7e14b594d18a049ac918a4a8603",$con);

Solution

  • Create a folder

    .bp-config/options.json in the parent folder

    and add

    {
        "PHP_EXTENSIONS": ["mysqli"]
    }
    

    in the options.json folder the sqli connect will work fine now