From 2860c01f5080ee83b3d2e0cf826ab56cc8c6930c Mon Sep 17 00:00:00 2001 From: Vinicius Dias Date: Fri, 24 Oct 2025 17:10:54 -0300 Subject: [PATCH 1/5] doc: Simplifiying the "A simple tutorial" page by removing the Apache and MySQL pre-requisites and using php's builtin server --- chapters/tutorial.xml | 88 +++++++++++-------------------------------- 1 file changed, 23 insertions(+), 65 deletions(-) diff --git a/chapters/tutorial.xml b/chapters/tutorial.xml index 14a257fb1937..c7763d718719 100644 --- a/chapters/tutorial.xml +++ b/chapters/tutorial.xml @@ -16,52 +16,15 @@ regular HTML pages. -
- What do I need? - - In this tutorial we assume that your server has activated support - for PHP and that all files ending in .php - are handled by PHP. On most servers, this is the default extension - for PHP files, but ask your server administrator to be sure. If - your server supports PHP, then you do not need to do anything. Just - create your .php files, put them in your - web directory and the server will automatically parse them for you. - There is no need to compile anything nor do you need to install - any extra tools. Think of these PHP-enabled files as simple HTML - files with a whole new family of magical tags that let you do all - sorts of things. - - - Let us say you want to save precious bandwidth and develop locally. - In this case, you will want to install a web server, such as - Apache, and of course - PHP. You will most likely - want to install a database as well, such as - MySQL. - - - You can either install these individually or choose a simpler way. Our - manual has installation instructions for - PHP (assuming you already have some web server set up). If - you have problems with installing PHP yourself, we would suggest you ask - your questions on our installation - mailing list. If you choose to go on the simpler route, then - locate a pre-configured package - for your operating system, which automatically installs all of these - with just a few mouse clicks. It is easy to setup a web server with PHP - support on any operating system, including MacOSX, Linux and Windows. - On Linux, you may find rpmfind and - PBone helpful for - locating RPMs. You may also want to visit apt-get to find packages for Debian. - -
-
Your first PHP-enabled page + + This tutorial assumes PHP is already installed. + If not, you can download and install it + here. + - Create a file named hello.php and put it - in your web server's root directory (DOCUMENT_ROOT) + Create a file named hello.php with the following content: @@ -73,17 +36,25 @@ echo "Hello World!"; -?> +]]> + + + Using your terminal, navigate to the directory containing this file and + start a development server with the following command: + + + Use your browser to access the file with your web server's URL, ending - with the /hello.php file reference. When developing locally this - URL will be something like http://localhost/hello.php - or http://127.0.0.1/hello.php but this depends on the - web server's configuration. If everything is configured correctly, this - file will be parsed by PHP and you will see the "Hello World" output displayed - in your browser. + with the /hello.php file reference. + According to the previous command executed, the URL will be + http://localhost:8000/hello.php + or http://127.0.0.1:8000/hello.php. + If everything is configured correctly, this file will be parsed by PHP + and you will see the "Hello World!" output displayed in your browser. PHP can be embedded within a normal HTML web page. That means inside your HTML document @@ -130,20 +101,7 @@ echo "Hello World!"; to pass on to PHP. Think of this as a normal HTML file which happens to have a set of special tags available to you that do a lot of interesting things. - - If you tried this example and it did not output anything, it prompted - for download, or you see the whole file as text, chances are that the - server you are on does not have PHP enabled, or is not configured properly. - Ask your administrator to enable it for you using the - Installation chapter - of the manual. If you are developing locally, also read the - installation chapter to make sure everything is configured - properly. Make sure that you access the file via http with the server - providing you the output. If you just call up the file from your file - system, then it will not be parsed by PHP. If the problems persist anyway, - do not hesitate to use one of the many - PHP support options. - + The point of the example is to show the special PHP tag format. In this example we used <?php to indicate the @@ -206,7 +164,7 @@ echo "Hello World!"; Get system information from PHP + From ce02e6c07953a5d238f77a8f5b67456c49fb4913 Mon Sep 17 00:00:00 2001 From: Vinicius Dias Date: Mon, 27 Oct 2025 20:16:29 -0300 Subject: [PATCH 2/5] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Tim Düsterhus --- chapters/tutorial.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/chapters/tutorial.xml b/chapters/tutorial.xml index c7763d718719..af72499c78b6 100644 --- a/chapters/tutorial.xml +++ b/chapters/tutorial.xml @@ -20,8 +20,8 @@ Your first PHP-enabled page This tutorial assumes PHP is already installed. - If not, you can download and install it - here. + Installation instructions can be found on the + download page. Create a file named hello.php @@ -44,7 +44,7 @@ echo "Hello World!"; From a297d7426e88c440d3efb456addbbf3cb8b21c0f Mon Sep 17 00:00:00 2001 From: Vinicius Dias Date: Tue, 28 Oct 2025 13:13:58 -0300 Subject: [PATCH 3/5] Update chapters/tutorial.xml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Tim Düsterhus --- chapters/tutorial.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/chapters/tutorial.xml b/chapters/tutorial.xml index af72499c78b6..6aee1d140391 100644 --- a/chapters/tutorial.xml +++ b/chapters/tutorial.xml @@ -164,7 +164,9 @@ php -S localhost:8000 Get system information from PHP From bb5ed82e0fc7fec6c18178c5079c70aa74f69274 Mon Sep 17 00:00:00 2001 From: Vinicius Dias Date: Tue, 28 Oct 2025 13:23:58 -0300 Subject: [PATCH 4/5] Adding closing tag to examples --- chapters/tutorial.xml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/chapters/tutorial.xml b/chapters/tutorial.xml index 6aee1d140391..8e3962437a15 100644 --- a/chapters/tutorial.xml +++ b/chapters/tutorial.xml @@ -36,6 +36,7 @@ echo "Hello World!"; +?> ]]> @@ -51,8 +52,7 @@ php -S localhost:8000 Use your browser to access the file with your web server's URL, ending with the /hello.php file reference. According to the previous command executed, the URL will be - http://localhost:8000/hello.php - or http://127.0.0.1:8000/hello.php. + http://localhost:8000/hello.php. If everything is configured correctly, this file will be parsed by PHP and you will see the "Hello World!" output displayed in your browser. @@ -167,6 +167,8 @@ php -S localhost:8000 ]]> @@ -202,7 +204,9 @@ phpinfo(); ]]> @@ -243,9 +247,11 @@ Mozilla/5.0 (Linux) Firefox/112.0 ]]> From 9a15900ddeee39aef1e71440e12dcccbcc7aa1db Mon Sep 17 00:00:00 2001 From: Vinicius Dias Date: Tue, 28 Oct 2025 13:47:59 -0300 Subject: [PATCH 5/5] Removing trailing whitespace --- chapters/tutorial.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chapters/tutorial.xml b/chapters/tutorial.xml index 8e3962437a15..bafbdb5b4ddf 100644 --- a/chapters/tutorial.xml +++ b/chapters/tutorial.xml @@ -51,7 +51,7 @@ php -S localhost:8000 Use your browser to access the file with your web server's URL, ending with the /hello.php file reference. - According to the previous command executed, the URL will be + According to the previous command executed, the URL will be http://localhost:8000/hello.php. If everything is configured correctly, this file will be parsed by PHP and you will see the "Hello World!" output displayed in your browser.