8000 Rewords · symfony/symfony-docs@ff086e9 · GitHub
[go: up one dir, main page]

Skip to content

Commit ff086e9

Browse files
committed
Rewords
1 parent 0aaf00d commit ff086e9

File tree

1 file changed

+17
-21
lines changed

1 file changed

+17
-21
lines changed

setup/file_permissions.rst

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,32 @@
11
Setting up or Fixing File Permissions
22
=====================================
33

4-
The ``var/`` directory in a Symfony application is used to store generated
5-
files (cache and logs) and file-based cache files. In the production
6-
environment, you often need to add explicit permissions to let Symfony
7-
write files into this directory.
4+
Symfony generates certain files in the ``var/`` directory of your project when
5+
running the application. In the ``dev`` :ref:`environment <configuration-environments>`,
6+
the ``bin/console`` and ``public/index.php`` files use ``umask()`` to make sure
7+
that the directory is writable. This means that you don't need to configure
8+
permissions when developing the application in your local machine.
89

9-
.. tip::
10+
However, using ``umask()`` is not considered safe in production. That's why you
11+
often need to configure some permissions explicitly in your production servers
12+
as explained in this article.
1013

11-
In dev environments, ``umask()`` is used in ``bin/console`` and
12-
``public/index.php`` to make sure the directory is writable. However,
13-
this is not a safe method and should not be used in production.
14+
Permissions Required by Symfony Applications
15+
--------------------------------------------
1416

15-
Setting up File Permissions in Production
16-
-----------------------------------------
17-
18-
This section describes the required permissions. See
19-
:ref:`the next section <setup-file-permissions>` on how to add the
20-
permissions.
17+
These are the permissions required to run Symfony applications:
2118

2219
* The ``var/log/`` directory must exist and must be writable by both your
2320
web server user and the terminal user;
2421
* The ``var/cache/`` directory must be writable by the terminal user (the
25-
user running ``cache:warmup`` or ``cache:clear``). It must also be writable
26-
by the web server user if you're using the
27-
:doc:`filesystem cache provider </components/cache/adapters/filesystem_adapter>`;
28-
or Doctrine query result cache.
22+
user running ``cache:warmup`` or ``cache:clear`` commands);
23+
* The ``var/cache/`` directory must be writable by the web server user if you use
24+
a :doc:`filesystem-based cache </components/cache/adapters/filesystem_adapter>`.
2925

3026
.. _setup-file-permissions:
3127

32-
Configuring File Permissions on Linux and macOS System
33-
------------------------------------------------------
28+
Configuring Permissions for Symfony Applications
29+
------------------------------------------------
3430

3531
On Linux and macOS systems, if your web server user is different from your
3632
command line user, you need to configure permissions properly to avoid issues.
@@ -84,7 +80,7 @@ If none of the previous methods work for you, change the ``umask`` so that the
8480
cache and log directories are group-writable or world-writable (depending
8581
if the web server user and the command line user are in the same group or not).
8682
To achieve this, put the following line at the beginning of the ``bin/console``,
87-
``web/app.php`` and ``web/app_dev.php`` files::
83+
and ``public/index.php`` files::
8884

8985
umask(0002); // This will let the permissions be 0775
9086

0 commit comments

Comments
 (0)
0