8000 [4.0] Setup & Page Creation updates by weaverryan · Pull Request #8544 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

[4.0] Setup & Page Creation updates #8544

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from
Closed
Changes from 1 commit
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
Next Next commit
WIP
  • Loading branch information
weaverryan committed Oct 29, 2017
commit 57918e4e30533a2b75ee0d8950b84398f1c1228b
107 changes: 52 additions & 55 deletions setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,99 +4,96 @@
Installing & Setting up the Symfony Framework
=============================================

This article explains how to install Symfony and solve the most common issues
that may appear during the installation process.

.. seealso::

Do you prefer video tutorials? Check out the `Joyful Development with Symfony`_
screencast series from KnpUniversity.

.. _installation-creating-the-app:

Creating Symfony Applications
-----------------------------

Symfony applications are created with `Composer`_, the package manager used by
modern PHP applications. If you don't have Composer installed in your computer,
start by :doc:`installing Composer globally </setup/composer>`. Then, execute
this command to create a new empty Symfony application based on its latest
stable version:
To create your new Symfony application, first make sure you're using PHP 7.1 or higher
and have `Composer`_ installed. If you don't, start by :doc:`installing Composer globally </setup/composer>`
on your system. Then, create a new project by running:

.. code-block:: terminal

$ composer create-project symfony/skeleton my-project

This will create a new ``my-project`` directory, download some dependencies into
it and even generate the basic directories and files you'll need to get started.
In other words, your new app is ready!

.. tip::

If your Internet connection is slow, you may think that Composer is not
doing anything. If that's your case, add the ``-vvv`` flag to the previous
command to display a detailed output of everything that Composer is doing.
You can also download a specific version of Symfony:

If your project needs to be based on a specific Symfony version, use the
optional third argument of the ``create-project`` command:
.. code-block:: terminal

.. code-block:: terminal
# use the most recent version in any Symfony branch
$ composer create-project symfony/skeleton my-project "3.3.*"

# use the most recent version in any Symfony branch
$ composer create-project symfony/skeleton my-project "3.3.*"
# use a beta or RC version (useful for testing new Symfony versions)
$ composer create-project symfony/skeleton my-project 3.3.0-BETA1

# use a specific Symfony version
$ composer create-project symfony/skeleton my-project "3.3.5"
Some version are long-term support (LTS) versions. Read the :doc:`Symfony Release process </contributing/community/releases>`
to learn more.

# use a beta or RC version (useful for testing new Symfony versions)
$ composer create-project symfony/skeleton my-project 3.3.0-BETA1
Running your Symfony Application
--------------------------------

.. note::
On production, you should use a web server like Nginx or Apache
(see :doc:`configuring a web server to run Symfony </setup/web_server_configuration>`).
But for development, it's even easier to use the Symfony PHP web server.

Read the :doc:`Symfony Release process </contributing/community/releases>`
to better understand why there are several Symfony versions and which one
to use for your projects.
First, move into your new project and install the server:

Running the Symfony Application
-------------------------------
.. code-block:: terminal

On production servers, Symfony applications use web servers such as Apache or
Nginx (see :doc:`configuring a web server to run Symfony </setup/web_server_configuration>`).
However, on your local development machine you can also use the web server
provided by Symfony, which in turn uses the built-in web server provided by PHP.
cd my-project
composer require server

First, :doc:`install the Symfony Web Server </setup/built_in_web_server>` and
then, execute this command:
To start the server, run:

.. code-block:: terminal

$ php bin/console server:run

Open your browser, access the ``http://localhost:8000/`` URL and you'll see the
application running. When you are finished working on your Symfony application,
stop the server by pressing ``Ctrl+C`` from the terminal or command console.
Open your browser and navigate to ``http://localhost:8000/``. If everything is working,
you'll see a welcome page. Later, when you are finished working, stop the server
by pressing ``Ctrl+C`` from your terminal.

.. tip::

Symfony's web server is great for developing, but should **not** be
used on production. Instead, use Apache or Nginx.
See :doc:`/setup/web_server_configuration`.
If you're using a VM, you may need to tell the server to bind to all IP addresses:

Checking Symfony Requirements
-----------------------------
.. code-block:: terminal

In addition to PHP 7.1, Symfony has other `technical requirements`_ that your
server must meet. Symfony provides a tool called "Requirements Checker" (or
``req-checker``) to check those requirements:
$ php bin/console server:start 0.0.0.0:8000

You should **NEVER** listen to all interfaces on a computer that is
directly accessible from the Internet.

Troubleshooting: The Requirements Checker
-----------------------------------------

If you're having any problems running Symfony, your system may be missing some
`technical requirements`_. Symfony has a "Requirements Checker" tool that you
can use to easily make sure your system is set up. First, move into your project
directory and install it:

.. code-block:: terminal

$ cd my-project/
$ composer require req-checker

The ``req-checker`` utility adds two PHP scripts in your application:
``bin/check.php`` and ``public/check.php``. Run the first one in the command
console and the second one in the browser. This is needed because PHP can define
a different configuration for both the command console and the web server, so
you need to check both.
The ``req-checker`` utility adds two PHP scripts to your application:
``bin/check.php`` and ``public/check.php``. Run the first one from your terminal:

.. code-block:: terminal

php bin/check.php

This will check your CLI environment. Run the second one from a browser (e.g.
``http://localhost:8000/check.php``) to check your web server environment.

Once you've fixed all the reported issues, uninstall the requirements checker:
Once you've fixed any issues, uninstall the requirements checker:

.. code-block:: terminal
409F
Expand Down
0