简体   繁体   English

尝试从全局名称空间Symfony2 + Ekino Wordpress调用函数“ wp”

[英]Attempted to call function “wp” from the global namespace Symfony2 + Ekino Wordpress

I got this error on prod : 我在prod上收到此错误:

Attempted to call function "wp" from the global namespace

I'm using 我正在使用

Symfony 2.8 with ekino/wordpress-bundle dev-master 使用ekino / wordpress-bundle dev-master的Symfony 2.8

The code is working fine on localhost both on prod and dev environement. 该代码在prod和dev环境上都可以在localhost上正常运行。

Here is the wp-blog-header.php file (standard wordpress file) 这是wp-blog-header.php文件(标准的wordpress文件)

<?php
/**
 * Loads the WordPress environment and template.
 *
 * @package WordPress
 */

if ( !isset($wp_did_header) ) {

    $wp_did_header = true;

    // Load the WordPress library.
    require_once( dirname(__FILE__) . '/wp-load.php' );

    // Set up the WordPress query.
    wp();

    // Load the theme template.
    require_once( ABSPATH . WPINC . '/template-loader.php' );

}

If I comment wp() and require_once( ABSPATH . WPINC . '/template-loader.php' ); 如果我评论wp()require_once( ABSPATH . WPINC . '/template-loader.php' ); I don't have the error and I can reach the home page (but I probably gonna have some issues later). 我没有错误,可以进入主页(但以后可能会出现一些问题)。

The cache is cleared. 缓存被清除。 Capisfony run composer install just before, so the autoload file should be ok. Capisfony在刚刚安装composer之前运行,因此自动加载文件应该没问题。

The exact error : 确切的错误:

[2016-07-05 12:51:37] request.CRITICAL: Uncaught PHP Exception Symfony\\Component\\Debug\\Exception\\UndefinedFunctionException: "Attempted to call function "wp" from the global namespace." [2016-07-05 12:51:37] request.Critical:未捕获的PHP异常Symfony \\ Component \\ Debug \\ Exception \\ UndefinedFunctionException:“试图从全局名称空间调用函数“ wp”。 at /var/www/blabla/releases/20160705104736/web/blog/wp-blog-header.php line 16 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\UndefinedFunctionException(code: 0): Attempted to call function \\"wp\\" from the global namespace. at /var/www/blabla/releases/20160705104736/web/blog/wp-blog-header.php:16)"} [] 在/var/www/blabla/releases/20160705104736/web/blog/wp-blog-header.php第16行{“ exception”:“ [object](Symfony \\ Component \\ Debug \\ Exception \\ UndefinedFunctionException(code:0):尝试从全局名称空间中调用函数\\“ wp \\”。位于/var/www/blabla/releases/20160705104736/web/blog/wp-blog-header.php:16)“] []

Any idea ? 任何想法 ? This is driving me crazy ... 这真让我抓狂 ...

In case you have this error check you wp-config.php file. 如果出现此错误,请检查wp-config.php文件。

In my case it was corrupted during the initial deployment process. 就我而言,它在初始部署过程中已损坏。 I regenerated it on the server and set the file as shared so capisfony won't overide it. 我在服务器上重新生成了文件,并将文件设置为共享文件,因此capisfony不会覆盖它。

I hope this can help someone. 我希望这可以帮助某人。

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

相关问题 Symfony2 + Twig:尝试从全局名称空间调用函数“ replace” - Symfony2 + Twig: Attempted to call function “replace” from the global namespace 尝试从Silex的全局名称空间调用函数 - Attempted to call function from the global namespace on Silex 尝试从名称空间symfony Controller调用函数 - Attempted to call function from namespace symfony Controller Symfony imap“试图从全局名称空间中调用函数“ imap_open”。 - Symfony imap “Attempted to call function ”imap_open“ from the global namespace.” Symfony2尝试从全局名称空间加载类。 您是否忘记了“使用”声明? - Symfony2 Attempted to load class from the global namespace. Did you forget a “use” statement? 试图从全局命名空间调用函数“yaml_parse_file” - Attempted to call function "yaml_parse_file" from the global namespace 尝试从名称空间-Symfony2加载类“ COM” - Attempted to load class “COM” from namespace -Symfony2 symfony2:尝试从名称空间加载类“ Memcache” - symfony2: Attempted to load class “Memcache” from namespace UndefinedFunctionException:尝试从命名空间Controller调用函数 - UndefinedFunctionException: Attempted to call function from namespace Controller 尝试从命名空间“App\Controller”调用 function - Attempted to call function from namespace “App\Controller”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM