简体   繁体   English

PHP 5.3.2-1ubuntu4.2中没有关闭支持

[英]No closure support in PHP 5.3.2-1ubuntu4.2

I just realised that a bit of PHP doesn't execute correctly on one server, but it does on another. 我刚刚意识到一些PHP在一台服务器上没有正确执行,但它在另一台服务器上执行。

They're both running Ubuntu 10.04 with PHP PHP 5.3.2 (PHP 5.3.2-1ubuntu4.2 with Suhosin-Patch (cli) (built: May 13 2010 20:03:45)) 他们都运行Ubuntu 10.04和PHP PHP 5.3.2(PHP 5.3.2-1ubuntu4.2与Suhosin-Patch(cli)(内置:2010年5月13日20:03:45))

I'm testing using: 我正在测试使用:

$f = function() {};

var_dump($f);
die();

On the server that works, the result is: 在有效的服务器上,结果是:

object(Closure)#1 (0) { } 对象(关闭)#1(0){}

On the one that doesn't, the result is: 在没有的那个,结果是:

UNKNOWN:0 UNKNOWN:0

What am I missing? 我错过了什么?

[edit] [编辑]

There seems to be an issue with having 2 closures in the same file: 在同一个文件中有2个闭包似乎存在问题:

<?php
$f = function() {};
$f2 = function() {};

var_dump($f);
var_dump($f2);
die();

Outputs: 输出:

UNKNOWN:0 UNKNOWN:0
object(Closure)#1 (0) {} 对象(关闭)#1(0){}

After some more Googling combined with ircmaxell's tip at phpinfo, I got a hint at eaccelerator. 经过一些谷歌搜索结合ircmaxell对phpinfo的提示,我得到了eaccelerator的提示。

The server that ran the code correctly was running eaccelerator 0.9.6.1, the one that didn't work was using 0.9.6. 正确运行代码的服务器正在运行eaccelerator 0.9.6.1,那个不工作的服务器使用的是0.9.6。

Compiled the new version from source and it fixed my issue. 从源代码编译了新版本,它解决了我的问题。

Thanks! 谢谢!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM