Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Symfony Webserver require index.php issue

i just updated my symfony version from 3.4.1 to 3.4.2 using composer update command(all OK).

when i tried to start the server i receive the following message:

Warning: require(index.php): failed to open stream: No such file or directory in (...)vendor\symfony\symfony\src\Symfony\Bundle\WebServerBundle\Resources\router.php on line 45

Fatal error: require(): Failed opening required 'index.php' (include_path='C:\xampp\php\PEAR') in (...)vendor\symfony\symfony\src\Symfony\Bundle\WebServerBundle\Resources\router.php on line 45

It makes reference to this peace of code

$script = getenv('APP_FRONT_CONTROLLER') ?: 'index.php';

//var_dump(getenv('APP_FRONT_CONTROLLER'));
//die();

    $_SERVER = array_merge($_SERVER, $_ENV);
    $_SERVER['SCRIPT_FILENAME'] = $_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR.$script;

    // Since we are rewriting to app_dev.php, adjust SCRIPT_NAME and PHP_SELF accordingly
    $_SERVER['SCRIPT_NAME'] = DIRECTORY_SEPARATOR.$script;
    $_SERVER['PHP_SELF'] = DIRECTORY_SEPARATOR.$script;

    require $script; //<==== HERE!!!

When I make a dump in the $script variable my result is false(there is no env variable called APP_FRONT_CONTROLLER) but when I run the server in another 3.4.1 symfony version the result is

string(11) "app_dev.php"

and all works fine.

Is this an issue of the version or a problem from my env.

If you need more information just ask for it.

thanks in advance.

like image 803
Juan I. Morales Pestana Avatar asked Dec 15 '17 15:12

Juan I. Morales Pestana


1 Answers

This is a bug in 3.4.2 and was already reported:

https://github.com/symfony/symfony/issues/25515

So only option for now are either downgrading to 3.4.1, use another webserver or fix it and submit a PR.

like image 88
Joe Avatar answered Oct 18 '22 16:10

Joe