如何从 php.ini 启用 mbstring?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6658561/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to enable mbstring from php.ini?
提问by radu_m
I have real difficulties with enabling mbstring extension on my localhost.
我在我的本地主机上启用 mbstring 扩展真的很困难。
I'm using XAMPP 1.7.4, for Windows, which has PHP 5.3.5, and tried to edit my php.ini file according to the documentationand various other examples I found online. After about 6 hours of this, all I managed to do is get a "Error 500 - Server error' message, that didn't go away even after I rolled-back all changes to the .ini file.
我在 Windows 上使用 XAMPP 1.7.4,它有 PHP 5.3.5,并尝试根据文档和我在网上找到的各种其他示例编辑我的 php.ini 文件。大约 6 个小时后,我设法做的就是收到“错误 500 - 服务器错误”消息,即使在我回滚对 .ini 文件的所有更改后,该消息也没有消失。
What I need to do, is create PDF invoices with Danish characters, using tFPDF, to support UTF-8 encoding.
我需要做的是使用丹麦字符创建 PDF 发票,使用tFPDF,以支持 UTF-8 编码。
If anybody here knows some tips, suggestions, or an example of a working php.ini setup, please help out, 'cause I'm starting to lose my hair over this one! :|
如果这里有人知道一些提示、建议或 php.ini 设置的示例,请提供帮助,因为我开始为此失去头发!:|
Thanks a lot!
非常感谢!
回答by Shahriyar Imanov
All XAMPP packages come with Multibyte String (php_mbstring.dll) extension installed.
所有 XAMPP 包都安装了多字节字符串 ( php_mbstring.dll) 扩展。
If you have accidentally removed DLL file from php/ext
folder, just add it back (get the copy from XAMPP zip archive - its downloadable).
如果您不小心从php/ext
文件夹中删除了 DLL 文件,只需将其重新添加(从 XAMPP zip 存档中获取副本 - 可下载)。
If you have deleted the accompanying INI configuration line from php.ini
file, add it back as well:
如果您从php.ini
文件中删除了随附的 INI 配置行,请将其添加回来:
extension=php_mbstring.dll
extension=php_mbstring.dll
Also, ensure to restart your webserver (Apache) using XAMPP control panel.
此外,请确保使用 XAMPP 控制面板重新启动您的网络服务器 ( Apache)。
Additional Info on Enabling PHP Extensions
有关启用 PHP 扩展的附加信息
- install extension (e.g. put php_mbstring.dllinto
/XAMPP/php/ext
directory) - in php.ini, ensure extension directory specified (e.g.
extension_dir = "ext"
) - ensure correct build of DLL file (e.g. 32bit thread-safe VC9 only works with DLL files built using exact same tools and configuration: 32bit thread-safe VC9)
- ensure PHP API versions match (If not, once you restart the webserver you will receive related error.)
- 安装扩展(例如将php_mbstring.dll放入
/XAMPP/php/ext
目录) - 在php.ini 中,确保指定扩展目录(例如
extension_dir = "ext"
) - 确保正确构建 DLL 文件(例如,32 位线程安全 VC9 仅适用于使用完全相同的工具和配置构建的 DLL 文件:32 位线程安全 VC9)
- 确保 PHP API 版本匹配(如果不匹配,一旦您重新启动网络服务器,您将收到相关错误。)