0
votes

I have a problem with this command : php bin/console server:run on Symfony 4

When I go to http://127.0.0.1:8000/ I have this error message :

Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0 Fatal error: Unknown: Failed opening required 'J:\my_project\vendor\symfony\web-server-bundle/Resources/router.php' (include_path='.;C:\php\pear') in Unknown on line 0

Indeed, the router.php file does not exist !

But if I run this command : php -S 127.0.0.1:8000 -t public everything is ok.

Any idea ?

2
php version? I have seen strange errors with php < 7.1.3Cerad

2 Answers

4
votes

First check that you have installed the SF4 Web Server bundle :

> composer require server --dev

then you can start using it through Symfony using run / start command

2
votes

Not sure if this is the case for you too, but it is probably worth checking (and may also be interesting for others having the same problem).

My antivirus software likes to put the router.php in quarantine (effectively removing it from that directory). Check if yours did the same and if so restore it and create an exception for that file. Additionally you should configure your antivirus to notify you if it puts something in quarantine, so you can intervene in time.