简体   繁体   English

在Symfony中生成捆绑后的ContextErrorException

[英]ContextErrorException after generating a bundle in Symfony

I have this problem for days now... I just do a fresh install on syfmony but after i create a bundle from symfony console i get this error from the webpage... 我现在已经有几天这个问题了……我只是在syfmony上进行了全新安装,但是在我从symfony控制台创建捆绑包之后,我从网页上得到了这个错误...

ContextErrorException: Warning: is_dir(): open_basedir restriction in effect. 
File(/srv/www/backend.tacon.eu/web) is not within the allowed path(s): (/var/www/clients/client1/web5/web:/var/www/clients/client1/web5/private:/var/www/clients/client1/web5/tmp:/var/www/backend.tacon.eu/web:/srv/www/backend.tacon.eu/web:/usr/share/php5:/usr/share/php:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin) in /var/www/clients/client1/web5/web/back/vendor/symfony/symfony/src/Symfony/Component/Process/ExecutableFinder.php line 59

I don't know why is this happening. 我不知道为什么会这样。 This is not my first symfony project and this never happens. 这不是我的第一个symfony项目,而且这永远不会发生。 Also on the same server i have various symfony projects. 同样在同一台服务器上,我有各种symfony项目。

Thanks in advance 提前致谢

I had the same problem after refresh install symfony using composer. 使用composer刷新安装symfony之后,我遇到了同样的问题。 I have solved this issue by editing php configuration file ( php.ini ). 我已经通过编辑php配置文件( php.ini )解决了这个问题。

Set the open_basedir option to null . open_basedir选项设置为null

More about open_basedir 有关open_basedir的更多信息

从ISPConfig:WebSites->您的站点->选项-> PHP open_basedir-> 在行尾添加:/srv/www/backend.tacon.eu/web

if you face this error on live server then you can solve this problem like this- 如果您在实时服务器上遇到此错误,则可以解决以下问题-

<?php
require_once __DIR__.'/../app/bootstrap.php.cache';
require_once __DIR__.'/../app/AppKernel.php';

use Symfony\Component\HttpFoundation\Request;

$kernel = new AppKernel('prod', true);
$kernel->loadClassCache();
// wrap the default AppKernel with the AppCache one

$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);

in line $kernel = new AppKernel('prod', true); $kernel = new AppKernel('prod', true); you may change it "prod" or "dev" and it's value like true or false ; 您可以将其更改为"prod""dev" ,其值为true or false

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

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