John Davidson

mysqli - Composer detected issues after months of server turned off - could update mess up my php settings?

0 comments
Message:


It's been long time (almost a year now) since I last run my ubuntu 20.04 server. So the first thing that I've done was global update of everything:


sudo -- sh -c 'apt-get update; apt-get upgrade -y; apt-get dist-upgrade -y; apt-get autoremove -y; apt-get autoclean -y'

There was a lot of downloading and installing, and after that I rebooted server and repeated process until I get clean record of 0 updates left.


However... after I run my old scripts, connection to database was failing. So I wanted to check in phpmyadmin if everything is as i left it months ago and I get this error:


Composer detected issues in your platform: Your Composer dependencies require the following PHP extensions to be installed: mysqli

I'm kinda worried now, since everything was running at the moment when I turned off server months ago. Since I have almost no experience in ubuntu/linux/servers things and I installed everything by an step-by-step guide, I'm afraid to touch anything else than regular update-all like above. Yet something went wrong. Is it possible that my php.ini was updated, and somehow mysqli was turned off?


Inside /etc/php I have 2 directories now: 8.0 and 8.1 - I'm not sure how it was before. Perhaps new version of PHP was installed and somehow it does not work with my phpmyadmin? What could happen and how can I repair it?



My Answer:
It is possible that the update process installed a new version of PHP (8.1) and that version does not have the mysqli extension enabled by default. You can check the php.ini file for both versions (located in /etc/php/8.0 and /etc/php/8.1) to see if the mysqli extension is enabled.

To do this, you can open the php.ini file for each version and search for the following line:


extension=mysqli


If you do not find this line in the php.ini file, you can add it manually and then restart your web server to apply the changes.

Alternatively, you can install the mysqli extension for the new PHP version by running the following command:


sudo apt-get install php8.1-mysql


After installing the mysqli extension, you should restart your web server to apply the changes.

Once you have enabled the mysqli extension for the new PHP version, your scripts should be able to connect to the database without any issues.

Rate this post

4 of 5 based on 9706 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us