@@ -219,41 +219,27 @@ If there are any issues, correct them now before moving on.
219
219
220
220
.. sidebar :: Setting up Permissions
221
221
222
+
222
223
One common issue is that the ``app/cache `` and ``app/logs `` directories
223
224
must be writable both by the web server and the command line user. On
224
225
a UNIX system, if your web server user is different from your command
225
226
line user, you can run the following commands just once in your project
226
227
to ensure that permissions will be setup properly.
227
228
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
-
244
229
**1. Using ACL on a system that supports chmod +a **
245
230
246
231
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.
249
233
250
234
.. code-block :: bash
251
235
252
236
$ rm -rf app/cache/*
253
237
$ rm -rf app/logs/*
254
238
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
+
257
243
258
244
**2. Using Acl on a system that does not support chmod +a **
259
245
@@ -264,9 +250,10 @@ If there are any issues, correct them now before moving on.
264
250
265
251
.. code-block :: bash
266
252
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
+
270
257
**3. Without using ACL **
271
258
272
259
If you don't have access to changing the ACL of the directories, you will
0 commit comments