Composer 运行版本问题

当安装 Composer 完成后,运行 Composer 没有显示配置正确。

错误信息为:

C:\Users\yhu>composer
PHP Warning:  PHP Startup: Unable to load dynamic library 'bz2' (tried: \xampp\php\ext\bz2 (The specified module could not be found.), \xampp\php\ext\php_bz2.dll (The specified module could not be found.)) in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library 'bz2' (tried: \xampp\php\ext\bz2 (The specified module could not be found.), \xampp\php\ext\php_bz2.dll (The specified module could not be found.)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'curl' (tried: \xampp\php\ext\curl (The specified module could not be found.), \xampp\php\ext\php_curl.dll (The specified module could not be found.)) in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library 'curl' (tried: \xampp\php\ext\curl (The specified module could not be found.), \xampp\php\ext\php_curl.dll (The specified module could not be found.)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'fileinfo' (tried: \xampp\php\ext\fileinfo (The specified module could not be found.), \xampp\php\ext\php_fileinfo.dll (The specified module could not be found.)) in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library 'fileinfo' (tried: \xampp\php\ext\fileinfo (The specified module could not be found.), \xampp\php\ext\php_fileinfo.dll (The specified module could not be found.)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'gd2' (tried: \xampp\php\ext\gd2 (The specified module could not be found.), \xampp\php\ext\php_gd2.dll (The specified module could not be found.)) in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library 'gd2' (tried: \xampp\php\ext\gd2 (The specified module could not be found.), \xampp\php\ext\php_gd2.dll (The specified module could not be found.)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'gettext' (tried: \xampp\php\ext\gettext (The specified module could not be found.), \xampp\php\ext\php_gettext.dll (The specified module could not be found.)) in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library 'gettext' (tried: \xampp\php\ext\gettext (The specified module could not be found.), \xampp\php\ext\php_gettext.dll (The specified module could not be found.)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'mbstring' (tried: \xampp\php\ext\mbstring (The specified module could not be found.), \xampp\php\ext\php_mbstring.dll (The specified module could not be found.)) in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library 'mbstring' (tried: \xampp\php\ext\mbstring (The specified module could not be found.), \xampp\php\ext\php_mbstring.dll (The specified module could not be found.)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'exif' (tried: \xampp\php\ext\exif (The specified module could not be found.), \xampp\php\ext\php_exif.dll (The specified module could not be found.)) in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library 'exif' (tried: \xampp\php\ext\exif (The specified module could not be found.), \xampp\php\ext\php_exif.dll (The specified module could not be found.)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'mysqli' (tried: \xampp\php\ext\mysqli (The specified module could not be found.), \xampp\php\ext\php_mysqli.dll (The specified module could not be found.)) in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library 'mysqli' (tried: \xampp\php\ext\mysqli (The specified module could not be found.), \xampp\php\ext\php_mysqli.dll (The specified module could not be found.)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'pdo_mysql' (tried: \xampp\php\ext\pdo_mysql (The specified module could not be found.), \xampp\php\ext\php_pdo_mysql.dll (The specified module could not be found.)) in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library 'pdo_mysql' (tried: \xampp\php\ext\pdo_mysql (The specified module could not be found.), \xampp\php\ext\php_pdo_mysql.dll (The specified module could not be found.)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'pdo_sqlite' (tried: \xampp\php\ext\pdo_sqlite (The specified module could not be found.), \xampp\php\ext\php_pdo_sqlite.dll (The specified module could not be found.)) in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library 'pdo_sqlite' (tried: \xampp\php\ext\pdo_sqlite (The specified module could not be found.), \xampp\php\ext\php_pdo_sqlite.dll (The specified module could not be found.)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'php_openssl.dll' (tried: \xampp\php\ext\php_openssl.dll (The specified module could not be found.), \xampp\php\ext\php_php_openssl.dll.dll (The specified module could not be found.)) in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library 'php_openssl.dll' (tried: \xampp\php\ext\php_openssl.dll (The specified module could not be found.), \xampp\php\ext\php_php_openssl.dll.dll (The specified module could not be found.)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'php_ftp.dll' (tried: \xampp\php\ext\php_ftp.dll (The specified module could not be found.), \xampp\php\ext\php_php_ftp.dll.dll (The specified module could not be found.)) in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library 'php_ftp.dll' (tried: \xampp\php\ext\php_ftp.dll (The specified module could not be found.), \xampp\php\ext\php_php_ftp.dll.dll (The specified module could not be found.)) in Unknown on line 0
PHP Warning:  Cannot open '\xampp\php\extras\browscap.ini' for reading in Unknown on line 0

Warning: Cannot open '\xampp\php\extras\browscap.ini' for reading in Unknown on line 0
PHP Fatal error:  Unable to start standard module in Unknown on line 0

Fatal error: Unable to start standard module in Unknown on line 0

C:\Users\yhu>

问题和解决

这个问题是因为你可能的 PHP 安装在 D 盘,但是运行上面的命令是在 C 盘运行的。

当我们进入 XAMPP 的安装路径后,再运行命令,就可以得到正确的显示。

主要问题在 XAMPP 的配置上,XAMPP 的配置是从当前运行盘符的根目录下进行运行的。

所以当需要运行相关的命令的话,必须要在 XAMPP 的安装路径下的盘符下运行。