2013-12-09 43 views
7

我:匿名函數不起作用:函數名必須是一個字符串

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' 

我測試此代碼:

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

$greet('PHP'); 

我收到此錯誤:

Fatal error: Function name must be a string 

在PHP 5.3.10-1ubuntu3.8上它正在運行。有沒有人發生了什麼事?

+3

[無法確認?(http://3v4l.org/AM45b) – h2ooooooo

+1

這可能對問題毫無關係,但是哪個版本的PHP是真的?在你的文章的第一部分,你說5.4.20。在最後一句中,你說5.3.10。 – Kyle

+0

適用於'PHP 5.5.5(cli)' – AbraCadaver

回答

0

順便說一句,我注意到的問題與此服務器(這是客戶端的VPN服務器),當我上載的symfony應用程序,我得到這個錯誤

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 
1

其因eAccelerator在,你應該禁用它

要關閉eAccelerator在,做以下修改您的的php.ini配置:

eaccelerator.enable 0 
eaccelerator.optimizer 0 

的.htaccess文件

php_flag eaccelerator.enable 0 
php_flag eaccelerator.optimizer 0 
相關問題