Last Updated: July 25, 2019
·
1.723K
· electblake

Local PHP Development Server like Node.js on OSX

I really enjoy the way other languages allow for non-daemon style webservers (built-in). PHP has added this option, so enjoy foreman or whatever process managers you need to run redis, etc.etc :)

Install PHP:
One Line Installation
(from: http://php-osx.liip.ch)

All you need to do to install the whole thing is opening up a Shell and execute the following line:

PHP 5.4 (Old stable)

curl -s http://php-osx.liip.ch/install.sh | bash -s 5.4

PHP 5.5 (Current stable)

curl -s http://php-osx.liip.ch/install.sh | bash -s 5.5

Run Webserver per Directory!

http://php.net/manual/en/features.commandline.webserver.php

Example - Starting with a specific document root directory

cd ~/public_html

php -S localhost:8000 -t foo/

2 Responses
Add your response

It's will work only for php greater than 5.4.0. So, using php 5.3.x in this context is wrong.

over 1 year ago ·

@gwinn, very right. Updated

over 1 year ago ·