@@ -10,9 +10,9 @@ the most common issues that may appear during the installation process.
10
10
Creating Symfony Applications
11
11
-----------------------------
12
12
13
- Symfony provides a dedicated application called **Symfony Installer ** to ease
13
+ Symfony provides a dedicated application called the **Symfony Installer ** to ease
14
14
the creation of Symfony applications. This installer is a PHP 5.4 compatible
15
- application that has to be installed in your system only once:
15
+ executable that needs to be installed on your system only once:
16
16
17
17
.. code-block :: bash
18
18
@@ -26,7 +26,7 @@ application that has to be installed in your system only once:
26
26
.. note ::
27
27
28
28
In Linux and macOS, a global ``symfony `` command is created. In Windows,
29
- move the ``symfony `` file to some directory included in the ``PATH ``
29
+ move the ``symfony `` file to a directory that's included in the ``PATH ``
30
30
environment variable to create the global command or move it to any other
31
31
directory convenient for you:
32
32
@@ -126,7 +126,7 @@ Running the Symfony Application
126
126
127
127
Symfony leverages the internal PHP web server (available since PHP 5.4) to run
128
128
applications while developing them. Therefore, running a Symfony application is
129
- a matter of browsing the project directory and executing this command:
129
+ a matter of browsing to the project directory and executing this command:
130
130
131
131
.. code-block :: bash
132
132
@@ -142,8 +142,7 @@ Welcome Page of Symfony:
142
142
143
143
If you see a blank page or an error page instead of the Welcome Page, there is
144
144
a directory permission misconfiguration. The solution to this problem is
145
- explained in the :ref: `Setting up Permissions <book-installation-permissions >`
146
- section.
145
+ explained in the :doc: `/setup/file_permissions `.
147
146
148
147
When you are finished working on your Symfony application, stop the server by
149
148
pressing ``Ctrl+C `` from the terminal or command console.
@@ -169,95 +168,20 @@ before moving on:
169
168
170
169
.. _book-installation-permissions :
171
170
172
- Setting up Permissions
173
- ----------------------
171
+ Fixing Permissions Problems
172
+ ---------------------------
174
173
175
- One important Symfony requirement is that the ``app/cache `` and ``app/logs ``
176
- directories must be writable both by the web server and the command line user.
177
-
178
- On Linux and macOS systems, if your web server user is different from your
179
- command line user, you need to configure permissions properly to avoid issues.
180
- There are several ways to achieve that:
181
-
182
- 1. Use the same user for the CLI and the web server
183
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
184
-
185
- Edit your web server configuration (commonly ``httpd.conf `` or ``apache2.conf ``
186
- for Apache) and set its user to be the same as your CLI user (e.g. for Apache,
187
- update the ``User `` and ``Group `` directives).
188
-
189
- .. caution ::
190
-
191
- If this solution is used in a production server, be sure this user only has
192
- limited privileges (no access to private data or servers, execution of
193
- unsafe binaries, etc.) as a compromised server would give to the hacker
194
- those privileges.
195
-
196
- 2. Using ACL on a system that supports ``chmod +a `` (macOS)
197
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
198
-
199
- On macOS systems, the ``chmod `` command supports the ``+a `` flag to define an
200
- ACL. Use the following script to determine your web server user and grant the
201
- needed permissions:
202
-
203
- .. code-block :: bash
204
-
205
- $ rm -rf app/cache/*
206
- $ rm -rf app/logs/*
207
-
208
- $ HTTPDUSER=` ps axo user,comm | grep -E ' [a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\ -f1`
209
- $ sudo chmod +a " $HTTPDUSER allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs
210
- $ sudo chmod +a " ` whoami` allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs
211
-
212
- 3. Using ACL on a system that supports ``setfacl `` (Linux/BSD)
213
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
214
-
215
- Most Linux and BSD distributions don't support ``chmod +a ``, but do support
216
- another utility called ``setfacl ``. You may need to install ``setfacl `` and
217
- `enable ACL support `_ on your disk partition before using it. Then, use the
218
- following script to determine your web server user and grant the needed permissions:
219
-
220
- .. code-block :: bash
221
-
222
- $ HTTPDUSER=` ps axo user,comm | grep -E ' [a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\ -f1`
223
- # if this doesn't work, try adding `-n` option
224
- $ sudo setfacl -R -m u:" $HTTPDUSER " :rwX -m u:` whoami` :rwX app/cache app/logs
225
- $ sudo setfacl -dR -m u:" $HTTPDUSER " :rwX -m u:` whoami` :rwX app/cache app/logs
226
-
227
- .. note ::
228
-
229
- setfacl isn't available on NFS mount points. However, storing cache and logs
230
- over NFS is strongly discouraged for performance reasons.
231
-
232
- 4. Without using ACL
233
- ~~~~~~~~~~~~~~~~~~~~
234
-
235
- If none of the previous methods work for you, change the umask so that the
236
- cache and log directories are group-writable or world-writable (depending
237
- if the web server user and the command line user are in the same group or not).
238
- To achieve this, put the following line at the beginning of the ``app/console ``,
239
- ``web/app.php `` and ``web/app_dev.php `` files::
240
-
241
- umask(0002); // This will let the permissions be 0775
242
-
243
- // or
244
-
245
- umask(0000); // This will let the permissions be 0777
246
-
247
- .. note ::
248
-
249
- Changing the umask is not thread-safe, so the ACL methods are recommended
250
- when they are available.
174
+ If you have any file permission errors or see a white screen, then read
175
+ :doc: `/setup/file_permissions ` for more information.
251
176
252
177
.. _installation-updating-vendors :
253
178
254
179
Updating Symfony Applications
255
180
-----------------------------
256
181
257
- At this point, you've created a fully-functional Symfony application in which
258
- you'll start to develop your own project. A Symfony application depends on
259
- a number of third-party libraries stored in the ``vendor/ `` directory and
260
- managed by Composer.
182
+ At this point, you've created a fully-functional Symfony application! Every Symfony
183
+ app depends on a number of third-party libraries stored in the ``vendor/ `` directory
184
+ and managed by Composer.
261
185
262
186
Updating those libraries frequently is a good practice to prevent bugs and
263
187
security vulnerabilities. Execute the ``update `` Composer command to update them
@@ -281,46 +205,30 @@ complexity of your project):
281
205
A good security practice is to execute this command regularly to be able to
282
206
update or replace compromised dependencies as soon as possible.
283
207
284
- Installing the Symfony Demo Application
285
- ---------------------------------------
286
-
287
- The `Symfony Demo application `_ is a fully-functional application that shows the
288
- recommended way to develop Symfony applications. The application has been
289
- conceived as a learning tool for Symfony newcomers and its source code contains
290
- tons of comments and helpful notes.
291
-
292
- If you have installed the Symfony Installer as explained in the above sections,
293
- install the Symfony Demo application anywhere in your system executing the
294
- ``demo `` command:
295
-
296
- .. code-block :: bash
297
-
298
- $ symfony demo
208
+ .. _installing-a-symfony2-distribution :
299
209
300
- Once downloaded, enter into the ``symfony_demo/ `` directory, run the PHP's
301
- built-in web server (``php app/console server:run ``) and access to the
302
- ``http://localhost:8000 `` URL to start using the Symfony Demo application.
210
+ Installing the Symfony Demo or Other Distributions
211
+ --------------------------------------------------
303
212
304
- .. _installing-a-symfony2-distribution :
213
+ You've already downloaded the Symfony Standard Edition: the default starting project
214
+ for all Symfony apps. You'll use this project throughout the documentation to build
215
+ your app!
305
216
306
- Installing a Symfony Distribution
307
- ---------------------------------
217
+ Symfony also provides some other projects and starting skeletons that you can use:
308
218
309
- Symfony distributions are fully-functional applications that include the Symfony
310
- core libraries, a selection of useful bundles, a sensible directory structure
311
- and some default configuration. In fact, when you created a Symfony application
312
- in the previous sections, you actually downloaded the default distribution
313
- provided by Symfony, which is called `Symfony Standard Edition `_.
219
+ `The Symfony Demo Application `_
220
+ This is a fully-functional application that shows the recommended way to develop
221
+ Symfony applications. The app has been conceived as a learning tool for Symfony
222
+ newcomers and its source code contains tons of comments and helpful notes.
314
223
315
- The Symfony Standard Edition is the best choice for developers starting with
316
- Symfony. However, the Symfony Community has published other distributions that
317
- you may use in your applications:
224
+ `The Symfony CMF Standard Edition `_
225
+ The `Symfony CMF `_ is a project that helps make it easier for developers to add
226
+ CMS functionality to their Symfony applications. This is a starting project
227
+ containing the Symfony CMF.
318
228
319
- * The `Symfony CMF Standard Edition `_ to get started with the `Symfony CMF `_
320
- project, which is a project that makes it easier for developers to add CMS
321
- functionality to Symfony applications.
322
- * The `Symfony REST Edition `_ shows how to build an application that provides a
323
- RESTful API using the `FOSRestBundle `_ and several other related bundles.
229
+ `Symfony REST Edition `_
230
+ Shows how to build an application that provides a RESTful API using the
231
+ `FOSRestBundle `_ and several other related Bundles.
324
232
325
233
.. _install-existing-app :
326
234
@@ -348,23 +256,27 @@ the following when installing an existing Symfony application:
348
256
# now Composer will ask you for the values of any undefined parameter
349
257
$ ...
350
258
259
+ Keep Going!
260
+ -----------
261
+
262
+ With setup behind you, it's time to :doc: `Create your First Page in Symfony </page_creation >`.
263
+
351
264
Learn More
352
265
----------
353
266
354
267
.. toctree ::
355
268
:maxdepth: 1
356
269
:glob:
357
270
358
- install/*
359
271
setup/*
272
+ install/*
360
273
361
274
.. _`Composer` : https://getcomposer.org/
362
- .. _`enable ACL support` : https://help.ubuntu.com/community/FilePermissionsACLs
363
275
.. _`Symfony Standard Edition` : https://github.com/symfony/symfony-standard
364
276
.. _`Symfony CMF Standard Edition` : https://github.com/symfony-cmf/symfony-cmf-standard
365
277
.. _`Symfony CMF` : http://cmf.symfony.com/
366
278
.. _`Symfony REST Edition` : https://github.com/gimler/symfony-rest-edition
367
279
.. _`FOSRestBundle` : https://github.com/FriendsOfSymfony/FOSRestBundle
368
280
.. _`Git` : http://git-scm.com/
369
281
.. _`Phar extension` : http://php.net/manual/en/intro.phar.php
370
- .. _`Symfony Demo application` : https://github.com/symfony/symfony-demo
282
+ .. _`The Symfony Demo application` : https://github.com/symfony/symfony-demo
0 commit comments