7

I have:

PHP Version 5.4.20
'./configure' '--disable-fileinfo' '--enable-bcmath' '--enable-calendar' '--enable-ftp' '--enable-gd-native-ttf' '--enable-libxml' '--enable-mbstring' '--enable-pdo=shared' '--enable-soap' '--enable-sockets' '--enable-zip' '--prefix=/usr/local' '--with-apxs2=/usr/local/apache/bin/apxs' '--with-curl=/opt/curlssl/' '--with-freetype-dir=/usr' '--with-gd' '--with-imap=/opt/php_with_imap_client/' '--with-imap-ssl=/usr' '--with-jpeg-dir=/usr' '--with-kerberos' '--with-libdir=lib64' '--with-libxml-dir=/opt/xml2' '--with-libxml-dir=/opt/xml2/' '--with-mcrypt=/opt/libmcrypt/' '--with-mysql=/usr' '--with-mysql-sock=/var/lib/mysql/mysql.sock' '--with-openssl=/usr' '--with-openssl-dir=/usr' '--with-pcre-regex=/opt/pcre' '--with-pdo-mysql=shared' '--with-pdo-sqlite=shared' '--with-pic' '--with-png-dir=/usr' '--with-xpm-dir=/usr' '--with-zlib' '--with-zlib-dir=/usr' 

And I test this code:

$greet = function($name) {
    printf("Hello %s\r\n", $name);
};

$greet('PHP');

I am getting this error:

Fatal error: Function name must be a string

On PHP Version 5.3.10-1ubuntu3.8 it is working as it should. Does anyone what is going on?

10
  • 3
    Cannot confirm? Commented Dec 9, 2013 at 19:13
  • 1
    This may have no bearing on the questions, but which version of PHP is it really? In the first part of your post, you say 5.4.20. In the last sentence, you say 5.3.10. Commented Dec 9, 2013 at 19:13
  • 2
    What does var_dump(phpversion()); output? Commented Dec 9, 2013 at 19:15
  • 1
    ..and what does var_dump($greet) output? Commented Dec 9, 2013 at 19:15
  • 2
    Do you install php from the source code or using the package manager as YUM or apt-get Commented Dec 9, 2013 at 19:22

3 Answers 3

5

Uhh, I think I just find out :( : http://snippets.webaware.com.au/howto/eaccelerator-and-php-closures-dont-mix

Sign up to request clarification or add additional context in comments.

Comments

1

its because of eAccelerator and you should disable it

To turn off eAccelerator, make the following changes in your php.ini configuration:

eaccelerator.enable 0
eaccelerator.optimizer 0

or in .htaccess files

php_flag eaccelerator.enable 0
php_flag eaccelerator.optimizer 0

Comments

0

Btw, I noticed problem with this server (it is client's VPN server) when I uploaded symfony application and I got this error

ContextErrorException: Warning: preg_replace_callback(): Requires argument 2, '', to be a valid callback in /home/client/vendor/symfony/symfony/src/Symfony/Component/Yaml/Unescaper.php line 56

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.