如何在 Windows 10 中添加 PHP 扩展名?
How to add PHP extension in Windows 10?
我已经从 Chocolatey on my Windows 10 PC. I have attempted to install and activate the PHP Redis 扩展下载了 PHP build,所以我下载了存档,将 php_redis.dll
扩展文件复制到默认的 ext
文件夹并修改了 php.ini
文件如下:
;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions ;
;;;;;;;;;;;;;;;;;;;;;;
; If you wish to have an extension loaded automatically, use the following
; syntax:
;
; extension=modulename
;
; For example:
;
; extension=mysqli
;
; When the extension library to load is not located in the default extension
; directory, You may specify an absolute path to the library file:
;
; extension=/path/to/extension/mysqli.so
;
; Note : The syntax used in previous PHP versions ('extension=<ext>.so' and
; 'extension='php_<ext>.dll') is supported for legacy reasons and may be
; deprecated in a future PHP major version. So, when it is possible, please
; move to the new ('extension=<ext>) syntax.
;
; Notes for Windows environments :
;
; - Many DLL files are located in the extensions/ (PHP 4) or ext/ (PHP 5+)
; extension folders as well as the separate PECL DLL download (PHP 5+).
; Be sure to appropriately set the extension_dir directive.
;
extension=bz2
extension=curl
extension=ffi
extension=ftp
extension=fileinfo
extension=gd2
extension=gettext
extension=gmp
extension=intl
extension=imap
extension=ldap
extension=mbstring
extension=exif ; Must be after mbstring as it depends on it
extension=mysqli
;extension=oci8_12c ; Use with Oracle Database 12c Instant Client
extension=odbc
extension=openssl
;extension=pdo_firebird
extension=pdo_mysql
;extension=pdo_oci
extension=pdo_odbc
extension=pdo_pgsql
extension=pdo_sqlite
extension=pgsql
extension=shmop
; The MIBS data available in the PHP distribution must be installed.
; See http://www.php.net/manual/en/snmp.installation.php
;extension=snmp
extension=soap
extension=sockets
extension=sodium
extension=sqlite3
extension=tidy
extension=xmlrpc
extension=xsl
; Added by Rumon:
extension=mongodb
extension=redis
也按照相同的路径安装 mongodb
扩展(从 here 下载)。
现在,当我执行与这些驱动程序相关的任何操作时,我收到系统找不到扩展的错误消息。例如:
$ php --ini
PHP Warning: PHP Startup: Unable to load dynamic library 'mongodb' (tried: ext\mongodb (The specified module could not be found.), ext\php_mongodb.dll (The specified module could not be found.)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'redis' (tried: ext\redis (The specified module could not be found.), ext\php_redis.dll (The specified module could not be found.)) in Unknown on line 0
Configuration File (php.ini) Path:
Loaded Configuration File: C:\tools\php74\php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)
为了大家方便,我提供了一个扩展目录的SS,have a look。
任何人都可以解释导致问题的原因吗?我该如何解决这个问题?
经过一段时间的研究,我发现“线程安全”是PHP世界中的事物!我装错了TS版,要的是NTS版
To everyone: When you try to install any PHP extension, check your system and make sure that you download the appropriate (TS/NTS) version.
干杯!
我已经从 Chocolatey on my Windows 10 PC. I have attempted to install and activate the PHP Redis 扩展下载了 PHP build,所以我下载了存档,将 php_redis.dll
扩展文件复制到默认的 ext
文件夹并修改了 php.ini
文件如下:
;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions ;
;;;;;;;;;;;;;;;;;;;;;;
; If you wish to have an extension loaded automatically, use the following
; syntax:
;
; extension=modulename
;
; For example:
;
; extension=mysqli
;
; When the extension library to load is not located in the default extension
; directory, You may specify an absolute path to the library file:
;
; extension=/path/to/extension/mysqli.so
;
; Note : The syntax used in previous PHP versions ('extension=<ext>.so' and
; 'extension='php_<ext>.dll') is supported for legacy reasons and may be
; deprecated in a future PHP major version. So, when it is possible, please
; move to the new ('extension=<ext>) syntax.
;
; Notes for Windows environments :
;
; - Many DLL files are located in the extensions/ (PHP 4) or ext/ (PHP 5+)
; extension folders as well as the separate PECL DLL download (PHP 5+).
; Be sure to appropriately set the extension_dir directive.
;
extension=bz2
extension=curl
extension=ffi
extension=ftp
extension=fileinfo
extension=gd2
extension=gettext
extension=gmp
extension=intl
extension=imap
extension=ldap
extension=mbstring
extension=exif ; Must be after mbstring as it depends on it
extension=mysqli
;extension=oci8_12c ; Use with Oracle Database 12c Instant Client
extension=odbc
extension=openssl
;extension=pdo_firebird
extension=pdo_mysql
;extension=pdo_oci
extension=pdo_odbc
extension=pdo_pgsql
extension=pdo_sqlite
extension=pgsql
extension=shmop
; The MIBS data available in the PHP distribution must be installed.
; See http://www.php.net/manual/en/snmp.installation.php
;extension=snmp
extension=soap
extension=sockets
extension=sodium
extension=sqlite3
extension=tidy
extension=xmlrpc
extension=xsl
; Added by Rumon:
extension=mongodb
extension=redis
也按照相同的路径安装 mongodb
扩展(从 here 下载)。
现在,当我执行与这些驱动程序相关的任何操作时,我收到系统找不到扩展的错误消息。例如:
$ php --ini
PHP Warning: PHP Startup: Unable to load dynamic library 'mongodb' (tried: ext\mongodb (The specified module could not be found.), ext\php_mongodb.dll (The specified module could not be found.)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'redis' (tried: ext\redis (The specified module could not be found.), ext\php_redis.dll (The specified module could not be found.)) in Unknown on line 0
Configuration File (php.ini) Path:
Loaded Configuration File: C:\tools\php74\php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)
为了大家方便,我提供了一个扩展目录的SS,have a look。
任何人都可以解释导致问题的原因吗?我该如何解决这个问题?
经过一段时间的研究,我发现“线程安全”是PHP世界中的事物!我装错了TS版,要的是NTS版
To everyone: When you try to install any PHP extension, check your system and make sure that you download the appropriate (TS/NTS) version.
干杯!