0

I am trying to deploy Codeigniter application in PCF. CF Push was success but i got the below error.

Type: Error

Message: Call to undefined function mysqli_init()

Filename: /home/vcap/app/htdocs/system/database/drivers/mysqli/mysqli_driver.php

Line Number: 135

Backtrace:

File: /home/vcap/app/htdocs/application/controllers/Dashboard.php
Line: 8
Function: __construct

File: /home/vcap/app/htdocs/index.php
Line: 315
Function: require_once

Does anyone how to deploy a php application with MySQLi driver enabled?

Raja
  • 3,477
  • 12
  • 47
  • 89
  • Does this answer your question? [Codeigniter: fatal error call to undefined function mysqli\_init()](https://stackoverflow.com/questions/33612956/codeigniter-fatal-error-call-to-undefined-function-mysqli-init) – Dharman Aug 25 '20 at 14:12
  • No. This question is related to Pivotal Cloud Foundry (PCF) Deployment. – Raja Aug 25 '20 at 14:39

1 Answers1

0

The extension isn't loaded. By default, the PHP Buildpack doesn't load any extensions.

The Cloud Foundry PHP Buildpack will ensure that extensions you require are loaded but you need to tell it to load them. There are two options for telling the buildpack which extensions to load:

  1. Composer. If you require your PHP extensions, the buildpack will see this and automatically enable them. Ex: "require": "ext-mysqli".

  2. Buildpack config file. Create .bp-config/php/php.ini.d/FILE-NAME.ini, where FILE-NAME is anything you want, I typically just call it extensions.ini. This file is read by PHP, so you can add any valid php.ini config, but for our purposes here you'd add extension=mysqli.so (or whatever extensions you want to load).

After making the changes from 1 or 2, just cf push your app again. The buildpack will run and it will enable the extensions you requested.

Daniel Mikusa
  • 13,716
  • 1
  • 22
  • 28