从任何文件夹启动php web服务器

从任何文件夹启动php web服务器,php,Php,我想从ubuntu系统中的一个文件夹启动一个php服务器,我尝试了以下命令 php -S localhost:8000 但它并没有启动服务器。我得到以下输出 Usage: php [options] [-f] <file> [--] [args...] php [options] -r <code> [--] [args...] php [options] [-B <begin_code>] -R <code> [-E

我想从ubuntu系统中的一个文件夹启动一个php服务器,我尝试了以下命令

php -S localhost:8000
但它并没有启动服务器。我得到以下输出

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

  -a               Run as interactive shell
  -c <path>|<file> Look for php.ini file in this directory
  -n               No php.ini file will be used
  -d foo[=bar]     Define INI entry foo with value 'bar'
  -e               Generate extended information for debugger/profiler
  -f <file>        Parse and execute <file>.
  -h               This help
  -i               PHP information
  -l               Syntax check only (lint)
  -m               Show compiled in modules
  -r <code>        Run PHP <code> without using script tags <?..?>
  -B <begin_code>  Run PHP <begin_code> before processing input lines
  -R <code>        Run PHP <code> for every input line
  -F <file>        Parse and execute <file> for every input line
  -E <end_code>    Run PHP <end_code> after processing all input lines
  -H               Hide any passed arguments from external tools.
  -s               Output HTML syntax highlighted source.
  -v               Version number
  -w               Output source with stripped comments and whitespace.
  -z <file>        Load Zend extension <file>.

  args...          Arguments passed to script. Use -- args when first argument
                   starts with - or script is read from stdin

  --ini            Show configuration file names

  --rf <name>      Show information about function <name>.
  --rc <name>      Show information about class <name>.
  --re <name>      Show information about extension <name>.
  --ri <name>      Show configuration for extension <name>.
用法:php[options][f][-][args…]
php[options]-r
[-][args…]
php[options][-B]-R
[-E][-][args…]
php[options][-B]-F[-E][-][args…]
php[选项]-[args…]
php[选项]-a
-运行方式为交互式shell
-c |在此目录中查找php.ini文件
-n不使用php.ini文件
-d foo[=bar]使用值“bar”定义INI条目foo
-e生成调试器/探查器的扩展信息
-f解析并执行。
-这有什么帮助
-我需要PHP信息
-仅限语法检查(lint)
-m显示在模块中编译
-r
在不使用脚本标记的情况下运行PHP

-B在处理输入行之前运行PHP
-R
为每个输入行运行PHP

-F解析并执行每个输入行
-E在处理所有输入行后运行PHP
-H隐藏从外部工具传递的任何参数。
-s输出突出显示的HTML语法源代码。
-v版本号
-w输出源代码,带有删除的注释和空白。
-z加载Zend扩展。
args。。。传递给脚本的参数。第一个参数时使用--args
以开头-或从标准输入读取脚本
--显示配置文件名
--rf显示有关功能的信息。
--显示关于类的信息。
--重新显示有关扩展的信息。
--ri显示扩展的配置。

但我在谷歌上搜索了很多次,没有找到任何解决方案。我应该如何继续?如果您使用apache,请帮助,然后打开终端并键入 cd/project/directory

切换项目目录的步骤 然后键入
php-S localhost:8000

我知道我必须安装php5 cli,并且必须更新到php5.4。现在它可以工作了

我在可用参数列表中看不到“-S”选项。您使用的是哪台服务器?
php-v
显示了什么?内置服务器仅在5.4上可用+