Memanfaatkan Built In Web Server PHP

Uddin Mtm
Uddin Mtm
Nov 3 · 1 min read

Buit-in web server, fitur ini sangat berguna untuk web developer terutama dalam proses development.

Berikut beberapa keuntungannya :

  1. Tidak perlu lagi install program apache sebagai web server. Hanya perlu install PHP saja
  2. Lokasi project bisa dimana saja tidak harus di folder htdocs atau www.

Yang dibutuhkan:

  • Progam PHP

Cara menggunakan:

berikut keterangan dari man php

--server addr:port
-S addr:port Start built-in web server on the given local address and port
--docroot docroot
-t docroot Specify the document root to be used by the built-in web server

Misalkan saya punya source code dari cms wordpress dan berada di path cms/wordpress. Maka, kita buat built-in web server untuk web wordpress ini seperti ini.

$ php -S localhost:7676 --docroot=cms/wordpress
PHP 7.3.8 Development Server started at Fri Aug 30 22:02:38 2019
Listening on http://localhost:7676
Document root is /home/ikr/cms/wordpress
Press Ctrl-C to quit.

Setelah sukses seperti diatas, untuk melihat webnya cukup dengan akses http://localhost:7676 saja. Dan seperti ini hasil desain tampilannya.

Semoga bermanfaat

Terima Kasih

PasuruanDev

Komunitas pegiat IT Pasuruan

Uddin Mtm

Written by

Uddin Mtm

PasuruanDev

Komunitas pegiat IT Pasuruan

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade