


Quickly build a development environment through PHP7's built-in web service, and it's all done with a BAT script
Since PHP5.4, PHP has a built-in web server. When deploying the development environment, we can completely ignore the WAMP or WNMP environment and use PHP directly.
Foreword: First of all, congratulations on the smooth launch of ThinkPHP5. I am very grateful to Think for its long-term contribution to PHP development. I will also make a small tool for you here, which can be considered as a marginal support for ThinkPHP5! Hehe...
Background: Since PHP5.4, PHP has a built-in web server. When deploying the development environment, we can completely ignore the WAMP or WNMP environment and directly use the command PHP -S http://localhost:8000 to make the PHP project Started running. In Windows, we usually do not set the system environment Path, and PHP configuration is a bit troublesome. It is not easy for some people to allow CMD to execute PHP.
Goal: No need to install WNMP or WAMP environment, realize rapid deployment of PHP development and running environment, and get started with one click.
Let’s get started: Here I wrote a BAT script for you, which can automatically detect and install the PHP environment, and start the PHP built-in WEB service. The content of the BAT script can be seen below. Just place a start.bat file in the project root directory and double-click this file to open your PHP project. The PHP version used by this tool is PHP7.0.10. When the script is run, a PHP directory will be automatically downloaded and placed under the root of the current drive letter. This PHP is the official window version. When the tool is initially run, you may be asked to install the VC library. Just install it according to the prompts. If you do not install it, PHP will not be able to run, resulting in various dll file loss errors! The specific deployment is as shown below, in which the start.bat file has been compressed and uploaded. Please download it in the attachment!
Note: Some anti-virus software will report viruses. You know this. It is recommended that you use Tencent Butler or add it to the trust list. Ha ha! ! !
Tips: To run the script for the first time, you need to download php.zip and VC library program through VB, so you need to wait for a while. Don’t be impatient and run the BAT script again. Of course, after installation, you can run it casually, and you can open it multiple times. After all, the WEB service port is randomly calculated.
@echo off<br>
<br>
:: PHP simple development environment construction tool V1.0<br>
::<br>
:: Author: Anyon <zoujingli><br>
:: Website: http://www.ctolog.com<br>
:: Created: 2016/09/22 20:20<br>
<br>
title HTTP-SERVER<br>
<br>
set pan=%~d0<br>
:: Determine whether the PHP running environment exists<br>
if not exist %pan%php (goto down) else (goto start)<br>
<br>
<br>
:start<br>
cls<br>
<br>
:: Temporarily set the PHP running environment path<br>
Set path=%~dp0..php;%~dp0php;%pan%php;%path% <br>
<br>
:: Random computing service running port<br>
set port=%random%<br>
Set /a port=port%%1000+2000<br>
Title [ %port% ] HTTP-SERVER<br>
<br>
::Open a browser window<br>
Start http://localhost:%port%<br>
<br>
::Start the Web service process<br>
@echo on<br>
@php -S localhost:%port%<br>
Goto end<br>
<br>
:down<br>
cls <br>
Echo.<br>
echo The local environment is not detected, trying to download and install, please wait...<br>
Echo.<br>
<br>
:: Resource path definition<br>
Set src=http://zoujingli.oschina.io/static/php-install/php.zip<br>
Set des=%pan%php.zip<br>
<br>
set sof_32=http://zoujingli.oschina.io/static/php-install/vc_redist.x86.exe<br>
Set sof_des_32=%pan%vc_redist.x86.exe<br>
<br>
set sof_64=http://zoujingli.oschina.io/static/php-install/vc_redist.x64.exe<br>
Set sof_des_64=%pan%vc_redist.x64.exe<br>
<br>
set script=%pan%script.vbs<br>
set dir=%pan%<br>
<br>
:: Generate VB script, download and process PHP support program<br>
echo Set xPost = CreateObject("Microsoft.XMLHTTP") >%script%<br>
echo xPost.Open "GET","%src%",0 >>%script%<br>
echo xPost.Send() >>%script%<br>
echo Set sGet = CreateObject("ADODB.Stream") >>%script%<br> echo sGet.Mode = 3 >>%script%<br>
echo sGet.Type = 1 >>%script%<br>
echo sGet.Open() >>%script%<br>
echo sGet.Write(xPost.responseBody) >>%script%<br>
echo sGet.SaveToFile "%des%",2 >>%script%<br>
<br>
if "%PROCESSOR_ARCHITECTURE%"=="x86" ( <br>
echo Set xPost = CreateObject("Microsoft.XMLHTTP") >>%script% <br>
echo xPost.Open "GET","%sof_32%",0 >>%script%<br>
echo xPost.Send() >>%script%<br>
echo Set sGet = CreateObject("ADODB.Stream") >>%script%<br>
echo sGet.Mode = 3 >>%script%<br>
echo sGet.Type = 1 >>%script%<br>
echo sGet.Open() >>%script%<br>
echo sGet.Write(xPost.responseBody) >>%script%<br>
echo sGet.SaveToFile "%sof_des_32%",2 >>%script%<br>
) else (<br>
echo Set xPost = CreateObject("Microsoft.XMLHTTP") >>%script% <br>
echo xPost.Open "GET","%sof_64%",0 >>%script%<br>
echo xPost.Send() >>%script%<br>
echo Set sGet = CreateObject("ADODB.Stream") >>%script%<br>
echo sGet.Mode = 3 >>%script%<br>
echo sGet.Type = 1 >>%script%<br>
echo sGet.Open() >>%script%<br>
echo sGet.Write(xPost.responseBody) >>%script%<br>
echo sGet.SaveToFile "%sof_des_64%",2 >>%script%<br>
)<br>
<br>
:: 定义ZIP解析函数<br>
echo Sub UnZip(ByVal myZipFile, ByVal myTargetDir) >>%script%<br>
echo Set fso = CreateObject("Scripting.FileSystemObject") >>%script%<br>
echo If NOT fso.FileExists(myZipFile) Then >>%script%<br>
echo Exit Sub >>%script%<br>
echo ElseIf NOT fso.FolderExists(myTargetDir) Then >>%script%<br>
echo fso.CreateFolder(myTargetDir) >>%script%<br>
echo End If >>%script%<br>
echo Set objShell = CreateObject("Shell.Application") >>%script%<br>
echo Set objSource = objShell.NameSpace(myZipFile) >>%script%<br>
echo Set objFolderItem = objSource.Items() >>%script%<br>
echo Set objTarget = objShell.NameSpace(myTargetDir) >>%script%<br>echo intOptions = 256 >>%script%<br>
echo objTarget.CopyHere objFolderItem, intOptions >>%script%<br>
echo End Sub >>%script%<br>
:: Unzip ZIP file<br>
echo UnZip "%des%", "%dir%" >>%script%<br>
:: Execute VB script<br>
cscript %script%<br>
<br>
cls<br>
Echo.<br>
Echo Here you will be prompted to install the VC support library, please follow the prompts! <br>
Echo.<br>
--- If it is not installed, please follow the prompts to install it! ---<br>
Echo.<br>
--- If it is already installed, please ignore and close the prompt box! ---<br>
Echo.<br>
<br>
::Install and generate VB cleaning script<br>
echo Set fso = CreateObject("Scripting.FileSystemObject") >%script%<br>
echo fso.deleteFile "%des%" >>%script%<br>
If "%PROCESSOR_ARCHITECTURE%"=="x86" (<br>
%sof_des_32%<br>
echo fso.deleteFile "%sof_des_32%" >>%script%<br>
) else (<br>
%sof_des_64%<br>
echo fso.deleteFile "%sof_des_64%" >>%script%<br>
)<br>
echo fso.deleteFile "%script%" >>%script%<br>
:: Execute VB script<br>
cscript %script%<br>
<br>
cls<br>
Goto start<br>
<br>
:end</zoujingli>
Update: The resource address is updated to the Oschina server
start.zip
( 1.44 KB Download: 10 times )

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Learn about Python programming with introductory code examples Python is an easy-to-learn, yet powerful programming language. For beginners, it is very important to understand the introductory code examples of Python programming. This article will provide you with some concrete code examples to help you get started quickly. Print HelloWorldprint("HelloWorld") This is the simplest code example in Python. The print() function is used to output the specified content

PHP variables store values during program runtime and are crucial for building dynamic and interactive WEB applications. This article takes an in-depth look at PHP variables and shows them in action with 10 real-life examples. 1. Store user input $username=$_POST["username"];$passWord=$_POST["password"]; This example extracts the username and password from the form submission and stores them in variables for further processing. 2. Set the configuration value $database_host="localhost";$database_username="username";$database_pa

The simplest code example of Java bubble sort Bubble sort is a common sorting algorithm. Its basic idea is to gradually adjust the sequence to be sorted into an ordered sequence through the comparison and exchange of adjacent elements. Here is a simple Java code example that demonstrates how to implement bubble sort: publicclassBubbleSort{publicstaticvoidbubbleSort(int[]arr){int

Title: From Beginner to Mastery: Code Implementation of Commonly Used Data Structures in Go Language Data structures play a vital role in programming and are the basis of programming. In the Go language, there are many commonly used data structures, and mastering the implementation of these data structures is crucial to becoming a good programmer. This article will introduce the commonly used data structures in the Go language and give corresponding code examples to help readers from getting started to becoming proficient in these data structures. 1. Array Array is a basic data structure, a group of the same type

"Go Language Programming Examples: Code Examples in Web Development" With the rapid development of the Internet, Web development has become an indispensable part of various industries. As a programming language with powerful functions and superior performance, Go language is increasingly favored by developers in web development. This article will introduce how to use Go language for Web development through specific code examples, so that readers can better understand and use Go language to build their own Web applications. 1. Simple HTTP Server First, let’s start with a

How to use PHP to write the inventory management function code in the inventory management system. Inventory management is an indispensable part of many enterprises. For companies with multiple warehouses, the inventory management function is particularly important. By properly managing and tracking inventory, companies can allocate inventory between different warehouses, optimize operating costs, and improve collaboration efficiency. This article will introduce how to use PHP to write code for inventory warehouse management functions, and provide you with relevant code examples. 1. Establish the database before starting to write the code for the inventory warehouse management function.

Java Selection Sorting Method Code Writing Guide and Examples Selection sorting is a simple and intuitive sorting algorithm. The idea is to select the smallest (or largest) element from the unsorted elements each time and exchange it until all elements are sorted. This article will provide a code writing guide for selection sorting, and attach specific Java sample code. Algorithm Principle The basic principle of selection sort is to divide the array to be sorted into two parts, sorted and unsorted. Each time, the smallest (or largest) element is selected from the unsorted part and placed at the end of the sorted part. Repeat the above

Huawei Cloud Edge Computing Interconnection Guide: Java Code Samples to Quickly Implement Interfaces With the rapid development of IoT technology and the rise of edge computing, more and more enterprises are beginning to pay attention to the application of edge computing. Huawei Cloud provides edge computing services, providing enterprises with highly reliable computing resources and a convenient development environment, making edge computing applications easier to implement. This article will introduce how to quickly implement the Huawei Cloud edge computing interface through Java code. First, we need to prepare the development environment. Make sure you have the Java Development Kit installed (
