iconv_strlen 函数导致执行超时,在 MAMP 上运行

iconv_strlen function causing execution timeout, running on MAMP(iconv_strlen 函数导致执行超时,在 MAMP 上运行)
本文介绍了iconv_strlen 函数导致执行超时,在 MAMP 上运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人在运行 MAMP 时遇到过 iconv_strlen 函数的问题吗?

Has anyone had issues with the iconv_strlen function while running MAMP?

推荐答案

我遇到了超时问题,但没有抛出任何异常.我在 Zend Framework 站点上工作.通过深入跟踪调试器,我将问题追溯到 iconv_strlen 的使用.它不是在任何奇怪的字符串上调用,它是一个用于验证主机名的简单函数.

I have been having a timeout issue with it, but not with any exceptions being thrown. I'm working on a Zend Framework site. By following the debugger deep into the guts, I tracked the problem down to the use of iconv_strlen. It's not being called on any strange string, it's a simple function being used to validate a hostname.

为了验证这个问题,我尝试了一个简单的 iconv_strlen("test", 'UTF-8');这会导致出现错误 - 浏览器中无尽的旋转加载器但没有错误日志消息,并且脚本超出了最大执行时间.看来这在这个版本的PHP中是一个未捕获的大块.

To verify the issue, I tried a simple iconv_strlen("test", 'UTF-8'); This causes the error to come up - endless spinning loader in browser but no error log message, and the script goes beyond the max execution time. It seems that this is an uncaught big in this version of PHP.

我的同事发现这篇文章可能会解决这个问题.我在 Mac OS X 机器上更新到最新的 Snow Leopard,它是 10.6.这似乎是一个已知错误,如果您构建自己的 php 或使用内置的 Apple 版本或使用端口,则有一种解决方法.

My colleague found this article which might address the issue. I'm on a Mac OS X machine updated to the latest Snow Leopard, which is 10.6. It seems that this is a known bug and there is a workaround if you build your own php or use the built in Apple version or use ports.

  • 错误 #49267 iconv 链接失败:未定义符号:_libiconv"
  • Mac OS 10.6 (Snow Leopard) 上的 PHP 5.3.0 - Fabien Potencier;2009 年 11 月 5 日

长话短说,你可以用上面的补丁重新编译你自己的 php,但这首先打败了 MAMP.

Long story short, you can delve into recompiling your own php with the above patch, but this kind of defeats the point of MAMP in the first place.

最快的解决方案就是从不使用 iconv_strlen()(或任何 iconv_ 函数)——如果你使用 Zend Framework,这不是一个选项——否则恢复 MAMP 以使用 php 5.2.

The quickest solution is simply either never use iconv_strlen() (or any of the iconv_ functions) - and this is not an option if you use Zend Framework - or else revert MAMP to use php 5.2.

在 MAMP 开始包含 php 源文件并提供一种方法来轻松重新编译与所有必要库捆绑在一起的 php 之前,这将必然保持包的限制.MAMP 运行良好,直到您需要重新编译 php.发生这种情况时,简单地使用端口要容易得多.

Until MAMP begins including php source files and providing a method by which to easily recompile the php bundled with all of the necessary libraries, this is will necessarily remain a limitation of the package. MAMP works great until you get to the point where you need to recompile php. When that happens, it's far easier to simply use ports.

这篇关于iconv_strlen 函数导致执行超时,在 MAMP 上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Convert JSON integers and floats to strings(将JSON整数和浮点数转换为字符串)
in php how do I use preg replace to turn a url into a tinyurl(在php中,如何使用preg替换将URL转换为TinyURL)
all day appointment for ics calendar file wont work(ICS日历文件的全天约会不起作用)
trim function is giving unexpected values php(Trim函数提供了意外的值php)
Basic PDO connection to MySQL(到MySQL的基本PDO连接)
PHP number_format returns 1.00(Php number_Format返回1.00)