Home > Backend Development > PHP Tutorial > php starts the built-in server

php starts the built-in server

angryTom
Release: 2023-04-07 17:22:01
forward
3859 people have browsed it

php starts the built-in server

Add php to the environment variable

1. If the php installation directory is E:\phpin\php

The dos command directly points to this directory E:\phpin\php\php.exe program file

2. Add the directory where php.exe is located (the installation directory is added to the environment variable) [Linux knows how to Generate environment variables]

环境变量配置在电脑-属相--高级配置里面
编辑path环境变量
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;E:\phpin\php\ 
其中 E:\phpin\php\ 为刚加入进去的path环境变量
Copy after login

Then run php directly without specifying the directory

Start the php built-in server

Since PHP5.4, PHP has a built-in Web server.

You can start the Web Server that comes with PHP through the php -S command, followed by the network address and listening port number. The default website root directory is the current directory. Visit

http://localhost:8080

Specify the root directory of the website, -t command

php -S localhost:8080 -t /www
Copy after login

If you need to close, close the dos window, or exit with ctrl c

PHP’s built-in Web Server is no problem for personal testing and small website development. If it is not a large-scale application, it still needs to cooperate with Nginx or Apache to achieve the highest efficiency.

For more PHP related knowledge, please visit PHP Chinese website!

The above is the detailed content of php starts the built-in server. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:csdn.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template