Since PHP 5.4 we can run web server for the testing purpose under the web development.
We have this option under CLI SAPI.
Lets now have a look how we can create/run the web server in php.
Output will be like this:
We have this option under CLI SAPI.
Lets now have a look how we can create/run the web server in php.
cd ~/public_htmlNow the web server is running on port 8000, we can change it as per our requirement as something is already running on this server port then we can change the port and make it available.
php -S localhost:8000
Output will be like this:
PHP 5.4.0 Development Server started at Thu Jul 21 10:43:28 2011So the php command leading with -S holds the key to run the server via CLI.
Listening on localhost:8000
Document root is /home/me/public_html
Press Ctrl-C to quit