mysqli_connect()无法使用bluemix

时间:2015-10-20 04:57:29

标签: php mysqli deployment ibm-cloud buildpack

我将php应用程序部署到bluemix但mysqli_connect函数无法正常工作...         然后我搜索并找到关于php buildpack         我将buildpack添加到mainfiest.yml文件

<html>
<head>

<title>Mail</title>


</head>
<body>
<?php
$to = "allen.titan357@gmail.com";
$sub = "Hi! my first SMTP mail.";
$txt = "Hope it has worked correctly";
$header = "From: donotreply@rmt.com" . "\r\n" . "CC: somebodyelse@example.com";
if(mail($to, $sub, $txt, $header)){
    echo "E-mail sent";
}else{
    echo "Sending failed";
}

?>

</body>

</html>

它还没有工作.....所以我找到另一个解决方案,在项目目录中创建.bp-config / option.json文件...并在文件下写入

applications:
    - path: .
      memory: 128M
      instances: 1
      domain: mybluemix.net
      name: Registeration
      host: registeration
      disk_quota: 1024M
      buildpack: https://github.com/cloudfoundry/php-buildpack.git

仍然mysqli_function无法正常工作.....但是当我在wampserver中打开我的项目时,它非常与bluemix服务器连接,所以代码没有问题....但问题是当我在bluemix上打开项目然后mysqli_connect函数不工作......

请帮助我.....

1 个答案:

答案 0 :(得分:2)

将composer.json设置为

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

使用此Bluemix PHP MySQL示例作为示例:https://github.com/IBM-Bluemix/php-mysql