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
... View more