When using the command line interface for WordPress (WP-CLI), I got the following error:
Fatal error: Uncaught Error: Call to undefined function mysql_connect() in site\wp-includes\class-wpdb.php:1807
mysqli extension in
php.ini solved this issue for me.
This is how I did it:
which phpin the terminal to find out which PHP is being used on the local machine.
- According to the path you got, open the file explorer and navigate to the folder where php.exe is located. I use “Local WP” to run the local PHP environment so this folder was something like:
- In this folder, look for the
php.inifile. If there are only
php.ini-productionfiles - rename one of these files to
- Edit the
;extension_dir = "ext"by removing the
;at the beginning.
- Save the file.
- Restart the terminal and try again.