How to enable mysqli in PHP in Windows


I was trying to run a SQL query in PHP. I was using mysqli command to connect to the database to retrieve data.

However, I ran into an error while loading the PHP file as –

Fatal error: Uncaught Error: Class 'mysqli' not found

This is how I solved it…

This error will appears if ‘mysqli’ is not installed in your local machine running on Windows.

To install ‘mysqli’ in PHP in Windows machine, follow these steps.

  1. Check your environment variables to find out your php installation directory
  2. Go to the directory where you had installed PHP.
  3. Locate the php.ini file.
  4. Open the php.ini file try to locate a line titled “;extension=mysqli”.
  5. By default it will appear as disabled or commented out. You can enable it by removing the semicolon.
  6. Change the line to “extension=mysql”, save and close the file.
  7. Restart your PHP server and start running your SQLI commands in PHP.

I hope you will find this post helpful.

Follow Me on Social Media

Boost your Sales with Free CRM Software

Streamline your sales process and increase productivity

  • Lead & Deal Tracking
  • Contact Management
  • Manage Tasks, Meetings, Emails
  • Custom Fields
  • Collaborate within Team

Signup for Free


Sign up for DigitalOcean cloud and get FREE $200 credits

Deploy your hobby projects for Free

DigitalOcean Referral Badge