Windows10下XAMPP环境安装Composer遇PDO加载错误问题求助
Hey there, let's work through these two warning messages step by step to get Composer installed smoothly:
1. Resolve "Unable to load dynamic library 'php_pdo.dll'"
First off, here's a key point: In modern PHP versions (like the ones bundled with recent XAMPP releases), PDO is built directly into the PHP core—you don't need to load a separate php_pdo.dll extension anymore. That's why the file is missing from your ext folder, even though you uncommented the line in php.ini.
To fix this:
- Open your
php.inifile (located atC:\xampp\php\php.ini) - Search for the line that looks like
extension=php_pdo.dllorextension=pdo - Re-add the comment marker (
;) at the start of that line to disable it - Save the file and restart your XAMPP Apache and PHP services
2. Fix "Module 'openssl' already loaded"
This warning pops up because the openssl extension is being loaded twice somewhere in your configuration. Here's how to track it down:
- Open your
php.inifile and search foropenssl - You'll likely find two uncommented lines related to it—maybe one like
extension=openssland another likeextension=php_openssl.dll - Keep only one uncommented line (preferably the one without the
.dllsuffix, which is standard for newer PHP versions) and comment out the duplicate - Additionally, check XAMPP's Apache configuration files (like
httpd.conforhttpd-xampp.confinC:\xampp\apache\conf) to make sure there aren't any extra lines loading the openssl module - Save all changes and restart your XAMPP services
Verify the Fix
After making these changes, open a command prompt and run:
php -v
Or to check loaded modules directly:
php -m
If the warnings are gone, you should be able to run the Composer installer without issues.
内容的提问来源于stack exchange,提问作者Firas-na

