Skip to content

IIS problem since 4.4 #37485

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
no-one opened this issue Jul 3, 2020 · 1 comment
Closed

IIS problem since 4.4 #37485

no-one opened this issue Jul 3, 2020 · 1 comment

Comments

@no-one
Copy link

no-one commented Jul 3, 2020

Symfony version(s) affected: >=4.4
(IIS version: 10.0.19041.332 on Windows 10)

Description
Since 4.4 it seems not possible to run a symfony application with IIS (no issues with 4.3 except the problem described in #36413). I stumbled over it when trying to upgrade my application, but the problem also occurs with a very simple setup.

You would expect the output Lucky number: 40 but you will only get [info] Matched route "app_lucky_number".

How to reproduce
Execute composer create-project symfony/skeleton=4.4.99 test and then just add the controller and route as described here: https://symfony.com/doc/current/page_creation.html

<?php
// src/Controller/LuckyController.php
namespace App\Controller;

use Symfony\Component\HttpFoundation\Response;

class LuckyController
{
   public function number(): Response
   {
       $number = random_int(0, 100);

       return new Response(
           '<html><body>Lucky number: '.$number.'</body></html>'
       );
   }
}
# config/routes.yaml

# the "app_lucky_number" route name is not important yet
app_lucky_number:
   path: /lucky/number
   controller: App\Controller\LuckyController::number

You will also need a web.config file for url rewrite (see Additional context).

If you start with composer create-project symfony/skeleton=4.3.99 test instead of 4.4.99 it will work without a problem. It will also work with APP_ENV=prod instead of APP_ENV=dev so it seems to have something to do with the environment.

Additional context
To run symfony on IIS I created a /public/web.config file:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <defaultDocument>
            <files>
                <add value="index.php" />
            </files>
        </defaultDocument>
		<rewrite>
            <rules>
                <rule name="Rewrite for Symfony" stopProcessing="true">
                    <match url="^" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="index.php" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

Any idea what's causing this problem?

@no-one
Copy link
Author

no-one commented Jul 3, 2020

Ok, that was stupid. The config works but be sure to use the right settings for application pool on IIS. They were wrong but caused no problem before 4.4. Now it works, sorry for this issue.

(There also were some deprecations so you should use monolog to see them.)

@no-one no-one closed this as completed Jul 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants