diff --git a/chapters/tutorial.xml b/chapters/tutorial.xml index 14a257fb1937..bafbdb5b4ddf 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. + Installation instructions can be found on the + download page. + - 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: @@ -74,16 +37,24 @@ 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. + 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,11 @@ echo "Hello World!"; Get system information from PHP + ]]> @@ -242,7 +204,9 @@ echo "Hello World!"; ]]> @@ -283,9 +247,11 @@ Mozilla/5.0 (Linux) Firefox/112.0 ]]>