About the use of PHP's built-in servers

Source: Internet
Author: User
Tags learn php

Today, just beginning to learn PHP formally (before a little understanding), the recommended learning site is w3school. At first, I didn't know that the Tomcat server does not support PHP scripts, directly put the. php file into Tomcat to run, the result of embedded PHP code snippet has no results. Later on the internet to know tomact can't parse PHP code. But there seems to be some configuration in the tomact. I installed the tomact server on my computer, but I didn't configure it for the time being. Nor does it use Apache or IIS. Instead, choose to use a server built into PHP. The PHP built-in server seems to be available in 5.4.0 or later versions.

The test has just been carried out. Sum it up again.

One. Download PHP. The address I downloaded is: https://secure.php.net/downloads.php. Then select a directory to unzip. The extracted directory is: E:\eclipseAll\php.

Two. Then cmd to open the DOS command window. Go to the extracted PHP directory. Because my directory structure is relatively simple. So it's a first-level entry.

Three. Take into account the future of learning. I have created a new directory dedicated to the. PHP code: E:\PHP\Test.

Four. At this point, in the DOS command window just enter:

php-s localhost:8000-t/php/test

Note: The parameter after T is the directory I created specifically for the. PHP code. Because my DOS command is located in the directory of E:\eclipseAll\php, so/php/test from the root of the E-disk to find the PHP directory, and then to find test.

Five. Enter the command after step four and the carriage return will appear:

Six. At this time, a test.php file is built in the E:\PHP\Test directory and saved.

1234567 <!DOCTYPE html><body>   <?php   echo"Hello World!";  ?><br></body>

Eight. In the browser address bar, enter: http://localhost:8000/Test.php. You can access the content in the test.php.

Nine. At this point, the first. PHP code is ready to run. The use of PHP built-in server is simple, these steps, for the initial study should be enough. Wait until later if there is any problem, or to install Apach and other servers, will also be updated and summarized.

Note: This article is just a summary of their own learning. If there is a mistake, please correct it, we learn from each other. If someone feels too rough or too simple, you can ignore it. Thank you

About the use of PHP's built-in servers

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.