安裝

Provided the required libraries are installed, users may enable enchant by adding the --with-enchant[=dir] option when compiling PHP.

Windows users must enable php_enchant.dll in order to use this extension.

注意: Additional setup on Windows

為了使此擴(kuò)展生效, DLL 文件必須能在 Windows 系統(tǒng)的 PATH 指示的路徑下找到。如何操作的信息,請(qǐng)參見(jiàn)題為“如何在 Windows 中將 PHP 目錄加到 PATH 中”的FAQ。雖然將 DLL 文件從 PHP 文件夾復(fù)制到 Windows 系統(tǒng)目錄也行,但不建議這樣做。 此擴(kuò)展需要下列文件在 PATH 路徑中: libenchant.dll, glib-2.dll, gmodule-2.dll.

Furthermore, it is necessary to copy at least one of the shipped providers in lib\enchant to \usr\local\lib\enchant-2 (which is an absolute path from the root of the current drive). Prior to PHP 8.0.0, i.e. using Enchant v1, the providers had to be copied to C:\enchant_plugins instead, where this path could be customized by creating the registry value HKEY_CURRENT_USER\SOFTWARE\Enchant\Config\Module_Dir and setting it to the desired path.