Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

This part of the PHP documentation says that I should be able to make a small, fake server to serve up some local .php files in a folder using

php -S localhost:8000

. But when I try that I get the following error:

Usage: php [options] [-f] <file> [--] [args...]
       php [options] -r <code> [--] [args...]
       php [options] [-B <begin_code>] -R <code> [-E <end_code>] [--] [args...]
       php [options] [-B <begin_code>] -F <file> [-E <end_code>] [--] [args...]
       php [options] -- [args...]
       php [options] -a

What am I doing wrong?

share|improve this question
1  
Which version are you using php -v? –  quanta Sep 26 '12 at 3:28
    
@quanta PHP 5.3.10-1ubuntu3.4 Thanks, the perfect question. –  isomorphismes Sep 26 '12 at 3:32
2  
As of PHP 5.4.0, the CLI SAPI provides a built-in web server. –  quanta Sep 26 '12 at 3:33
1  
The very first sentence of the documentation you linked to states: "As of PHP 5.4.0, the CLI SAPI provides a built-in web server". I suggest you read more carefully next time. –  John Gardeniers Sep 26 '12 at 3:37
add comment

1 Answer

up vote 1 down vote accepted

You need to be using at least PHP 5.4 to do this. If you're using a lower version, it won't work.

share|improve this answer
    
Thanks! That was definitely my error. –  isomorphismes Sep 26 '12 at 3:34
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.