Skip to content

Commit 06b4163

Browse files
committed
replaced PHP built-in server with the Symfony CLI one
1 parent 0255293 commit 06b4163

File tree

3 files changed

+17
-16
lines changed

3 files changed

+17
-16
lines changed

configuration/micro_kernel_trait.rst

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,12 @@ Next, create an ``index.php`` file that creates a kernel class and executes it::
7474
$response->send();
7575
$kernel->terminate($request, $response);
7676

77-
That's it! To test it, you can start the built-in web server:
77+
That's it! To test it, start the :doc:`Symfony Local Web Server
78+
</setup/symfony_server>`:
7879

7980
.. code-block:: terminal
8081
81-
$ php -S localhost:8000
82+
$ symfony server:start
8283
8384
Then see the JSON response in your browser:
8485

@@ -335,12 +336,13 @@ this:
335336
├─ composer.json
336337
└─ composer.lock
337338
338-
As before you can use PHP built-in server:
339+
As before you can use the :doc:`Symfony Local Web Server
340+
</setup/symfony_server>`:
339341

340342
.. code-block:: terminal
341343
342344
cd web/
343-
$ php -S localhost:8000
345+
$ symfony server:start
344346
345347
Then see webpage in browser:
346348

create_framework/front_controller.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ to test this code properly.
5858

5959
Moreover, adding a new page means that we need to create a new PHP script,
6060
which name is exposed to the end user via the URL
61-
(``http://127.0.0.1:4321/bye.php``): there is a direct mapping between the PHP
61+
(``http://127.0.0.1:8000/bye.php``): there is a direct mapping between the PHP
6262
script name and the client URL. This is because the dispatching of the request
6363
is done by the web server directly. It might be a good idea to move this
6464
dispatching to our code for better flexibility. This can be achieved by routing
@@ -109,17 +109,17 @@ we return a custom 404 page; you are now in control of your website.
109109

110110
To access a page, you must now use the ``front.php`` script:
111111

112-
* ``http://127.0.0.1:4321/front.php/hello?name=Fabien``
112+
* ``http://127.0.0.1:8000/front.php/hello?name=Fabien``
113113

114-
* ``http://127.0.0.1:4321/front.php/bye``
114+
* ``http://127.0.0.1:8000/front.php/bye``
115115

116116
``/hello`` and ``/bye`` are the page *paths*.
117117

118118
.. tip::
119119

120120
Most web servers like Apache or nginx are able to rewrite the incoming URLs
121121
and remove the front controller script so that your users will be able to
122-
type ``http://127.0.0.1:4321/hello?name=Fabien``, which looks much better.
122+
type ``http://127.0.0.1:8000/hello?name=Fabien``, which looks much better.
123123

124124
The trick is the usage of the ``Request::getPathInfo()`` method which returns
125125
the path of the Request by removing the front controller script name including
@@ -153,12 +153,12 @@ web root directory:
153153
Now, configure your web server root directory to point to ``web/`` and all
154154
other files won't be accessible from the client anymore.
155155

156-
To test your changes in a browser (``http://localhost:4321/hello?name=Fabien``), run
157-
the PHP built-in server:
156+
To test your changes in a browser (``http://localhost:8000/hello?name=Fabien``),
157+
run the :doc:`Symfony Local Web Server </setup/symfony_server>`:
158158

159159
.. code-block:: terminal
160160
161-
$ php -S 127.0.0.1:4321 -t web/ web/front.php
161+
$ symfony server:start --passthru=front.php
162162
163163
.. note::
164164

create_framework/introduction.rst

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,13 @@ start with the simplest web application we can think of in PHP::
101101

102102
printf('Hello %s', $name);
103103

104-
You can use the PHP built-in server to test this great application in a browser
105-
(``http://localhost:4321/index.php?name=Fabien``):
104+
You can use the :doc:`Symfony Local Web Server </setup/symfony_server>` to test
105+
this great application in a browser
106+
(``http://localhost:8000/index.php?name=Fabien``):
106107

107108
.. code-block:: terminal
108109
109-
$ php -S 127.0.0.1:4321
110-
111-
Otherwise, you can always use your own server (Apache, Nginx, etc.).
110+
$ symfony server:start
112111
113112
In the :doc:`next chapter </create_framework/http_foundation>`, we are going to
114113
introduce the HttpFoundation Component and see what it brings us.

0 commit comments

Comments
 (0)