Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add documentation forerror:dump command#20706

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
javiereguiluz merged 1 commit intosymfony:7.3frompyrech:error-dump-command
Mar 10, 2025
Merged
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletionscontroller/error_pages.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -336,3 +336,49 @@ time and again, you can have just one (or several) listeners deal with them.
your application (like :class:`Symfony\\Component\\Security\\Core\\Exception\\AccessDeniedException`)
and takes measures like redirecting the user to the login page, logging them
out and other things.

Dumping error pages in static HTML files
----------------------------------------

When a web server cannot handle a request or when it triggers an error without
calling the PHP application, it will return its default error pages, instead of
rendering the errors as defined in your application (whether it's Symfony's
default "Oops" error page or the pages you customized in your application).

To avoid that and always have your web server rendering your application's error
pages, you can dump each HTTP status error in a their own static HTML files:

.. code-block:: terminal

$ php bin/console error:dump [--force] var/cache/prod/error_pages

.. note::

By default, it will dump HTML files for each HTTP status error.
You can restrict that to dump only some HTTP status code by passing them as
in the second argument of the command.

Once the static pages are generated, you can now configure your web server to use
them instead of their default error page. Here is an example configuration with
nginx:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

wdyt adding a doc forfrankenphp ?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I don't use Frankenphp, so feel free to suggest a working configuration for it (or for any other web server) 😉

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

We can add new config formats in future PRs if folks contribute them. Thanks.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

i will try to when I upgrade to v7.3, bookmarking this comments flows

pyrech reacted with thumbs up emoji

.. code-block:: nginx

# /etc/nginx/conf.d/example.com.conf
server {
# Your existing serverconfiguration
# ...


# Configure nginx to serve your application's error pages
error_page 400 /error_pages/400.html;
error_page 401 /error_pages/401.html;
# ...
error_page 510 /error_pages/510.html;
error_page 511 /error_pages/511.html;

location ^~ /error_pages/ {
root /path/to/your/symfony/var/cache/error_pages;
internal; # allows this location block to not be triggered when a user manually call these /error_pages/.* urls
}
}

[8]ページ先頭

©2009-2025 Movatter.jp