Home  >  Article  >  Backend Development  >  php starts the built-in server

php starts the built-in server

angryTom
angryTomforward
2019-10-16 13:13:073806browse

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环境变量

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

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!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete