3

I just realised that a bit of PHP doesn't execute correctly on one server, but it does on another.

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))

I'm testing using:

$f = function() {};

var_dump($f);
die();

On the server that works, the result is:

object(Closure)#1 (0) { }

On the one that doesn't, the result is:

UNKNOWN:0

What am I missing?

[edit]

There seems to be an issue with having 2 closures in the same file:

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

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

Outputs:

UNKNOWN:0
object(Closure)#1 (0) {}

apaderno
  • 28,547
  • 16
  • 75
  • 90
Andrei Serdeliuc ॐ
  • 5,828
  • 5
  • 39
  • 66
  • 1
    Are you sure the other is **running** 5.3? It could be installed, but have an older version running? Try running a `phpinfo();` to make sure the relevant settings are all the same between them (although I'm not sure settings would have anything to do with this problem, but it would verify the version installed). – ircmaxell Aug 09 '10 at 12:56
  • 1
    Have you any more information on the *differences* between the two setups? – salathe Aug 09 '10 at 12:56
  • Can you set `error_reporting` to `E_ALL | E_STRICT`? Perhaps some error is being silently suppressed...? – ircmaxell Aug 09 '10 at 13:04
  • If it would be a problem with the PHP version, then in the second example the output would be `UNKNOWN` twice; the fact one variable is reported to contain a closure object makes me think the script is really using PHP 5.3. – apaderno Aug 09 '10 at 13:08

1 Answers1

2

After some more Googling combined with ircmaxell's tip at phpinfo, I got a hint at 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.

Compiled the new version from source and it fixed my issue.

Thanks!

Andrei Serdeliuc ॐ
  • 5,828
  • 5
  • 39
  • 66