简体   繁体   中英

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

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. Also on the same server i have various symfony projects.

Thanks in advance

I had the same problem after refresh install symfony using composer. I have solved this issue by editing php configuration file ( php.ini ).

Set the open_basedir option to null .

More about 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); you may change it "prod" or "dev" and it's value like true or false ;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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