Skip to content

[WebServerBundle] server not work after update #25515

Closed
@russoalberto

Description

@russoalberto
Q A
Bug report? yes
Feature request? no
BC Break report? yes
RFC? no
Symfony version 3.4.2

After "composer update" to migrate from 3.3. to 3.4, the WebServerBundle no longer works.

When i open the site in bowser, i have this error:

PHP 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 42

Activity

abzolv

abzolv commented on Dec 15, 2017

@abzolv

Same here. I upgraded from 3.4.1.

remindbg

remindbg commented on Dec 15, 2017

@remindbg

Same here, fresh new installs

Simperfit

Simperfit commented on Dec 16, 2017

@Simperfit
Contributor

Could you please post a reproducer on github ? Because i've test both symfony-standard and flex (symfony-skeleton) on fresh install and they are both working.

In case you need some help you can read this blog post : https://symfony.com/doc/current/contributing/code/reproducer.html

abzolv

abzolv commented on Dec 16, 2017

@abzolv

Here is all you need to do on your local development computer to reproduce the bug:

symfony new testapp 3.4.2
cd testapp
composer require symfony/web-server-bundle
./bin/console server:run

In your web browser address bar, type http://127.0.0.1:8000 and press Enter.

Simperfit

Simperfit commented on Dec 16, 2017

@Simperfit
Contributor

Same as flex :

#( 12/16/17@12:53PM )( hamza@MBP-de-Amrouche ):~/projet/contrib/symfony_reproducer
   cd testapp 
#( 12/16/17@12:53PM )( hamza@MBP-de-Amrouche ):~/projet/contrib/symfony_reproducer/testapp
   composer require symfony/web-server-bundle 
Using version ^4.0 for symfony/web-server-bundle
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
    Prefetch start: total: 1
    1/1:    https://codeload.github.com/symfony/web-server-bundle/legacy.zip/bd56cde308dc2b9d2aa6506ee740c0c3853aeb2f
    Finished: success:1, skipped:0, failure:0, total: 1
Package operations: 1 install, 0 updates, 0 removals
  - Installing symfony/web-server-bundle (v4.0.2): Loading from cache
Writing lock file
Generating autoload files
Changelogs summary:

 - symfony/web-server-bundle installed in version v4.0.2
   Release notes: https://github.com/symfony/web-server-bundle/releases/tag/v4.0.2

> Incenteev\ParameterHandler\ScriptHandler::buildParameters
Updating the "app/config/parameters.yml" file
> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap
> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache

 // Clearing the cache for the dev environment with debug                       
 // true                                                                        

                                                                                
 [OK] Cache for the "dev" environment (debug=true) was successfully cleared.    
                                                                                

> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installAssets

 Trying to install assets as relative symbolic links.

                                                                                
 [OK] No assets were provided by any bundle.                                    
                                                                                

> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installRequirementsFile
> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::prepareDeploymentTarget
#( 12/16/17@12:53PM )( hamza@MBP-de-Amrouche ):~/projet/contrib/symfony_reproducer/testapp
   ./bin/console server:run 

                                                                                                                        
 [ERROR] The document root directory "/Users/hamza/projet/contrib/symfony_reproducer/testapp/public" does not exist.    
                                                                                                                        

By the way, if you use the symfony installer you don't need to require de web-server-bundle since it requires symfony/symfony (so the whole framework).

Event following what you said still cannot reproduce. I get an error, I can't run the server.

@Valix could you please send us the steps to get this error ? Are you using windows or linux ? Do you a have empty public folder ?

abzolv

abzolv commented on Dec 16, 2017

@abzolv

@Simperfit, why are you testing this under V4.0.2? The problem is in 3.4.2. The web server works perfectly in 3.4.1. It is broken in 3.4.2.

Simperfit

Simperfit commented on Dec 16, 2017

@Simperfit
Contributor

I'm not testing this under 4.0.2, it's using the composer it install 4.0.2, not using composer you have already the webserver installed and it works.
capture d ecran 2017-12-16 a 13 35 37

abzolv

abzolv commented on Dec 16, 2017

@abzolv

Here is what I do and what I get:

symfony new testapp 3.4.2
Downloading Symfony...
[snip]
Preparing project...
✔ Symfony 3.4.2 was successfully installed. Now you can:
* Change your current directory to /data/testapp
* Configure your application in app/config/parameters.yml file.

* Run your application:
    1. Execute the php bin/console server:run command.
    2. Browse to the http://localhost:8000 URL.

* Read the documentation at http://symfony.com/doc

Local1:data abzolv$ cd testapp
Local1:data abzolv$ ./bin/console server:run

[OK] Server listening on http://127.0.0.1:8000

// Quit the server with CONTROL-C.

PHP 7.0.16 Development Server started at Sat Dec 16 08:43:01 2017
Listening on http://127.0.0.1:8000
Document root is /data/testapp/web
Press Ctrl-C to quit.

In the web browser I get the error:

Fatal error: require(): Failed opening required 'index.php' (include_path='.:') in /data/testapp/vendor/symfony/symfony/src/Symfony/Bundle/WebServerBundle/Resources/router.php on line 42


Points to note:

  • I have never installed V4, only V3.x
  • This is on MacOS
Simperfit

Simperfit commented on Dec 16, 2017

@Simperfit
Contributor

@abzolv Thanks! With the version of PHP I can reproduce the bug. Ill try to look into this to understand why with this version of php the behaviour is wrong.

12 remaining items

pacogomezarnal

pacogomezarnal commented on Dec 17, 2017

@pacogomezarnal

But if you print APP_FRONT_CONTROLLER from WebServerConfig, the enviroment variable is correct because it prints app_dev.php

Simperfit

Simperfit commented on Dec 17, 2017

@Simperfit
Contributor

Yes please check #25523. It fixes the bug

pacogomezarnal

pacogomezarnal commented on Dec 17, 2017

@pacogomezarnal

OK. Thank you

pacogomezarnal

pacogomezarnal commented on Dec 17, 2017

@pacogomezarnal

Checked and working

abzolv

abzolv commented on Dec 19, 2017

@abzolv

I want to ask a question here that's been bugging me for a few days.

Does this issue perhaps reveal an important gap in Symfony's quality assurance processes?

Most people would not use the leading or bleeding edge versions of either Symfony or PHP to develop large production systems. Most people would use the latest LTS versions.

This bug was caused by a combination of PHP and Symfony versions that were not the latest and greatest versions in the development cycles of either. And Symfony's QA processes missed it, even though the bug rendered the WebserverBundle completely inoperative.

So, the question is, going forward, how can it be assured that combinations of older versions get properly QA'd to prevent similar bugs from slipping through in versions that are likely used by most people for serious production work?

I wouldn't want to venture any recommendations because I'm not familiar with Symfony's existing QA procedures.

nicolas-grekas

nicolas-grekas commented on Dec 19, 2017

@nicolas-grekas
Member

@abzolv WebServerBundle is a pure dev dependency. The thing that is broken is a helper that never runs at prod time. It may happen that this is less tested than the more critical parts of the code (every other part of the code base is more critical for sure.)

added a commit that references this issue on Dec 20, 2017

bug #25523 [WebServerBundle] fix a bug where require would not requir…

johnrivelt

johnrivelt commented on Dec 27, 2017

@johnrivelt

I have still the same issue.
It seems that symfony lts still indicates old dependencies which has a bug.

php: 7.0.0 / 7.2.0
os : windows 10

php symfony new project lts => 3.4.2

php bin/console server:run

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 42

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

xabbuh

xabbuh commented on Dec 27, 2017

@xabbuh
Member

The PR solving this was not part of a release yet. You would need up to depend on 3.4@dev for now.

damienalexandre

damienalexandre commented on Dec 28, 2017

@damienalexandre
Contributor

With Symfony 3.4, you can also run APP_FRONT_CONTROLLER=app.php php bin/console server:start instead of installing a not tagged version.

ghost
Simperfit

Simperfit commented on Jan 4, 2018

@Simperfit
Contributor

@cyx-veera like @damienalexandre said, or wait for a new release containing the patch.

godoakbrutal

godoakbrutal commented on Feb 20, 2018

@godoakbrutal

This work for me

  1. clear all cache (remove folder cache in var folder) and do clear:cache
  2. restart server server:stop then make a new server:start

sorry if I was wrong :)

oukhrib

oukhrib commented on Feb 6, 2019

@oukhrib

This work for me

$script = isset($_ENV['APP_FRONT_CONTROLLER']) ? $_ENV['APP_FRONT_CONTROLLER'] : 'app_dev.php';

Line 33 : app_dev.php instead of index.php

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @damienalexandre@nicolas-grekas@russoalberto@johnrivelt@xabbuh

        Issue actions

          [WebServerBundle] server not work after update · Issue #25515 · symfony/symfony