Sunday, October 1, 2017

Simple WebServer using PHP

It Works!

This is a simple example to design your own PHP web server used for application development or testing PHP script and should not be used on a public network. It works similar to the Apache web server with limited functionalities and not intended to be a full-featured web server. This tutorial demonstrates just to activate the built-in web server through a batch file.

Instructions

For designing a PHP web server, we simply need PHP software alone. The batch file(.bat) was created to activate the built-in web server, automatically open the default web browser with custom folder as root directory (www), and minimize the command line window while running the PHP script.

Step 1: Download and extract compresed file (.zip) formatted PHP software according to your system platform. I have downloaded VC14 x64 Thread Safe (2017-Sep-26 23:04:10) for 64-bit Windows 10 OS.

PHP 7.1

Step 2: Create a new folder www in the extracted folder. Also, create a new file index.html in the www folder with the following line “<h1>It Works!</h1>” and save it.

Step 3: Create an batch file PHPServer.bat in the extracted folder using any ASCII text editor and enter the following commands.

START /min php -S localhost:88 -t www/ START "" http://localhost:88

Step 4: Double-click PHPServer.bat file to run web server and launch the web browser.

It Works!

0 comments :

Post a Comment