- 1 year ago
How to enable the PDO MySQL extension on Windows?
To enable the PDO MySQL extension on Windows, you need to follow these steps:
Locate the
php.ini
file: Find the PHP installation directory on your Windows system. Thephp.ini
file is typically located in thephp
subdirectory. For example, if you have PHP installed inC:\php
, thephp.ini
file can be found atC:\php\php.ini
.Open
php.ini
file: Use a text editor to open thephp.ini
file.Find the extension line: Look for the following line in the
php.ini
file:ini;extension=pdo_mysql
It might be preceded by a semicolon (;), indicating that the extension is currently disabled.
Remove the semicolon: Remove the semicolon (;) from the beginning of the line to uncomment it and enable the PDO MySQL extension. The modified line should look like this:
iniextension=pdo_mysql
Save the changes: Save the modified
php.ini
file.Restart the web server: Restart your web server (e.g., Apache, IIS) to apply the changes.
Verify the extension: To confirm that the PDO MySQL extension is enabled, create a PHP file (e.g.,
info.php
) with the following content:php<?php
phpinfo();
?>
Place this file in your web server's document root directory (e.g.,
htdocs
orwww
). Access the file via a web browser (e.g.,http://localhost/info.php
). Look for a section labeled "PDO drivers" in the PHP info page, and ensure that "mysql" is listed among the supported PDO drivers. This indicates that the PDO MySQL extension is now enabled.
That's it! The PDO MySQL extension should now be enabled on your Windows system.