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

Appearance settings

Commit 0543134

Browse filesBrowse files
committed
Merge pull request symfony#2851 from ph-il/2.2
Optimisation of Setting Up Permission
2 parents 9760fe0 + b0a2b1f commit 0543134
Copy full SHA for 0543134

File tree

Expand file treeCollapse file tree

1 file changed

+10
-23
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+10
-23
lines changed

‎book/installation.rst

Copy file name to clipboardExpand all lines: book/installation.rst
+10-23Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -219,41 +219,27 @@ If there are any issues, correct them now before moving on.
219219

220220
.. sidebar:: Setting up Permissions
221221

222+
222223
One common issue is that the ``app/cache`` and ``app/logs`` directories
223224
must be writable both by the web server and the command line user. On
224225
a UNIX system, if your web server user is different from your command
225226
line user, you can run the following commands just once in your project
226227
to ensure that permissions will be setup properly.
227228

228-
**Note that not all web servers run as the user** ``www-data`` as in the examples
229-
below. Instead, check which user *your* web server is being run as and
230-
use it in place of ``www-data``.
231-
232-
On a UNIX system, this can be done with one of the following commands:
233-
234-
.. code-block:: bash
235-
236-
$ ps aux | grep httpd
237-
238-
or
239-
240-
.. code-block:: bash
241-
242-
$ ps aux | grep apache
243-
244229
**1. Using ACL on a system that supports chmod +a**
245230

246231
Many systems allow you to use the ``chmod +a`` command. Try this first,
247-
and if you get an error - try the next method. Be sure to replace ``www-data``
248-
with your web server user on the first ``chmod`` command:
232+
and if you get an error - try the next method.
249233

250234
.. code-block:: bash
251235
252236
$ rm -rf app/cache/*
253237
$ rm -rf app/logs/*
254238
255-
$ sudo chmod +a "www-data allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs
256-
$ sudo chmod +a "`whoami` allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs
239+
$ APACHEUSER=`ps aux | grep -E '[a]pache|[h]ttpd' | grep -v root | head -1 | cut -d\ -f1`
240+
$ sudo chmod +a "$APACHEUSER allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs
241+
$ sudo chmod +a "`whoami` allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs
242+
257243

258244
**2. Using Acl on a system that does not support chmod +a**
259245

@@ -264,9 +250,10 @@ If there are any issues, correct them now before moving on.
264250

265251
.. code-block:: bash
266252
267-
$ sudo setfacl -R -m u:www-data:rwX -m u:`whoami`:rwX app/cache app/logs
268-
$ sudo setfacl -dR -m u:www-data:rwx -m u:`whoami`:rwx app/cache app/logs
269-
253+
$ APACHEUSER=`ps aux | grep -E '[a]pache|[h]ttpd' | grep -v root | head -1 | cut -d\ -f1`
254+
$ sudo setfacl -R -m u:$APACHEUSER:rwX -m u:`whoami`:rwX app/cache app/logs
255+
$ sudo setfacl -dR -m u:$APACHEUSER:rwX -m u:`whoami`:rwX app/cache app/logs
256+
270257
**3. Without using ACL**
271258

272259
If you don't have access to changing the ACL of the directories, you will

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.