Modifying mysqli.reconnect Value

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
L5 Sessionator
100% helpful (10/10)

Expedition uses PHP to perform the backend actions. Some of those require interactions with MariaDB databases and use mysqli as a driver to connect to these databases.

 

In order to ensure that connections to the database are alive, we want to modify one of the PHP System parameters that allows reconnections to the database once those are lost.

 

Open a terminal to Expedition and edit the following files:

 

1. php.ini for Apache

Edit the php.ini file for Apache with the following command

sudo nano /etc/php/7.0/apache2/php.ini

change (you can use the Search feature with ^W)

mysqli.reconnect = Off

to

mysqli.reconnect = On

Write the changes with ^O and exit nano with ^X

 

 

2. php.ini for CLI

Edit the php.ini file for Apache with the following command

sudo nano /etc/php/7.0/cli/php.ini

change (you can use the Search feature with ^W)

mysqli.reconnect = Off

to

mysqli.reconnect = On

 Write the changes with ^O and exit nano with ^X

 

 

3. Apply the changes

Once the changes are done, apply them by

sudo service apache2 restart

Rate this article:
Comments
L5 Sessionator

Did you modify the file

/etc/php/7.0/apache2/php.ini

or could it be that you only modified

/etc/php/7.0/cli/php.ini?

Some information about the process at
https://live.paloaltonetworks.com/t5/Expedition-Articles/Modifying-mysqli-reconnect-value/ta-p/21922...

 

L3 Networker

I have modifed this file and saved it yet it still shows red when I load Expedition.  This is my only remaining red X on the introduction page.  I'm on version 1.0.107.

L7 Applicator

Have you restarted apache?

 

sudo systemctl restart apache2
L3 Networker

I ended up going back to my snapshot right after I upgraded to 1.0.107.  Then I went back to edit the failes with Nano and this time I went to the "Off" and backspaced three times and typed "On".  Saved it and exited and restared the entire appliance and this time I have 100% green.   Not sure what happened.  Before when I edited it showed "On" but was not working.  I did it again with the process above and it worked.


Thanks,

Bob

L0 Member

Hello World,

 

     The 'one liner' below - bold text - worked well for me and was a quick and easy way to update both files in one easy swoop. This is using the substitution function 's' in sed (stream editor) with a global replace parameter 'g'. Technically, this is two commands (one for each file) separated by a semicolon.

 

     The ^W command in nano was causing issues for me as I had my VM in a browser, and ^W would close my browser tab instead of do a search in nano. Don't forget to restart Apache afterwards! 🙂

 

sed -i 's/mysqli.reconnect = Off/mysqli.reconnect = On/g' /etc/php/7.0/apache2/php.ini; sed -i 's/mysqli.reconnect = Off/mysqli.reconnect = On/g' /etc/php/7.0/cli/php.ini

  • 25733 Views
  • 5 comments
  • 6 Likes
Register or Sign-in
Contributors
Article Dashboard
Version history
Last Updated:
‎10-07-2019 08:40 AM
Updated by:
Retired Member