Symfony 3.3 built-in server error

Viewed 5664

I'm developping an app under windows 10 + wamp + php 7 + Symfony 3.3

I'm trying to use the built-in server :

php bin/console server:run
[OK] Server listening on http://127.0.0.1:8000
// Quit the server with CONTROL-C.

And when I go to http://localhost:8000/app_dev.php/ or http://127.0.0.1:8000/app_dev.php

I get this error :

Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0 
Fatal error: Unknown: Failed opening required 'C:\wamp\www\myproject\vendor\symfony\symfony\src\Symfony\Bundle\WebServerBundle/Resources/router.php' (include_path='.;C:\php\pear') in Unknown on line 0

Same error under every routes. My routes are correct and works fine outside of the built-in server...

Can you help me with this issue please ?

5 Answers

I got the same error, even when installing via composer.

It turns out that for whatever reason when composer downloaded the project, the required file listed in the error you get (vendor\symfony\symfony\src\Symfony\Bundle\WebServerBundle/Resources/router.php) was not included...

To fix this, I manually added it from https://github.com/symfony/web-server-bundle/blob/master/Resources/router.php and then my symfony app worked as expected.

I had to restart my computer in order to actually add the file because somehow I was locked out of adding it even as admin in Windows after launching the php server.

UPDATE:

Even better than manually adding the file, I just deleted the symfony folder from the vendor folder in the project and reran composer update. the router.php file is indeed downloaded. Sometimes when running bin/console server:run it gets deleted. Not sure why.

It happened to me when upgrading from Symfony 3.1 to Symfony 3.4.

The reason was that I had left the development server running when I executed the command:

composer update

The solution:

  • Delete the contents of vendor folder
  • Execute composer update
  • Install the new Symfony development server bundle (follow the instructions)
  • Execute the server for development in a new port

    php bin/console server:start localhost:3421

I had this problem too : it was AVAST that blocked the "router.php" file.

I went into avast -> protection -> quarantine, and put an exception of the router.php file

And then everything worked again

Related