PHP 5.5 在使用 symfony 时无法识别服务器

PHP 5.5 won't recognise server when using symfony

我在 mac 中使用 php 5.5.27,当我 运行 $php app/console server:run 我得到:

  [InvalidArgumentException]                                
  There are no commands defined in the "server" namespace. 

我还查看了 php -v 的 php 版本,php app/check.php 显示了相同的版本 php 5.5.27,有什么见解吗?

我用 symfony-installer 安装 symfony,并且 php 已经安装在我的 machine 中。

即使我 运行 $php app/console 我得到:

Symfony version 2.0.12 - app/dev/debug

Usage:
  [options] command [arguments]

Options:
  --help           -h Display this help message.
  --quiet          -q Do not output any message.
  --verbose        -v Increase verbosity of messages.
  --version        -V Display this application version.
  --ansi              Force ANSI output.
  --no-ansi           Disable ANSI output.
  --no-interaction -n Do not ask any interactive question.
  --shell          -s Launch the shell.
  --env            -e The Environment name.
  --no-debug          Switches off debug mode.

Available commands:
  help                                  Displays help for a command
  list                                  Lists commands
assetic
  assetic:dump                          Dumps all assets to the filesystem
assets
  assets:install                        Installs bundles web assets under a public web directory
cache
  cache:clear                           Clears the cache
  cache:warmup                          Warms up an empty cache
container
  container:debug                       Displays current services for an application
doctrine
  doctrine:cache:clear-metadata         Clears all metadata cache for a entity manager
  doctrine:cache:clear-query            Clears all query cache for a entity manager
  doctrine:cache:clear-result           Clears result cache for a entity manager
  doctrine:database:create              Creates the configured databases
  doctrine:database:drop                Drops the configured databases
  doctrine:ensure-production-settings   Verify that Doctrine is properly configured for a production environment.
  doctrine:generate:crud                Generates a CRUD based on a Doctrine entity
  doctrine:generate:entities            Generates entity classes and method stubs from your mapping information
  doctrine:generate:entity              Generates a new Doctrine entity inside a bundle
  doctrine:generate:form                Generates a form type class based on a Doctrine entity
  doctrine:mapping:convert              Convert mapping information between supported formats.
  doctrine:mapping:import               Imports mapping information from an existing database
  doctrine:mapping:info                 Shows basic information about all mapped entities
  doctrine:query:dql                    Executes arbitrary DQL directly from the command line.
  doctrine:query:sql                    Executes arbitrary SQL directly from the command line.
  doctrine:schema:create                Executes (or dumps) the SQL needed to generate the database schema
  doctrine:schema:drop                  Executes (or dumps) the SQL needed to drop the current database schema
  doctrine:schema:update                Executes (or dumps) the SQL needed to update the database schema to match the current mapping metadata
generate
  generate:bundle                       Generates a bundle
  generate:doctrine:crud                Generates a CRUD based on a Doctrine entity
  generate:doctrine:entities            Generates entity classes and method stubs from your mapping information
  generate:doctrine:entity              Generates a new Doctrine entity inside a bundle
  generate:doctrine:form                Generates a form type class based on a Doctrine entity
init
  init:acl                              Mounts ACL tables in the database
mopa
  mopa:generate:crud                    Generates a CRUD based on a Doctrine entity
router
  router:debug                          Displays current routes for an application
  router:dump-apache                    Dumps all routes as Apache rewrite rules
swiftmailer
  swiftmailer:spool:send                Sends emails from the spool

它不会显示服务器命令:(

你 运行 Symfony 2.0 版本太旧了。首先升级到最新版本或 LTS 版本,然后你有服务器命令。否则你不能使用它们。

命令 server:run 适用于版本 2.3,在更高版本上其 server:start

这是说明书

http://symfony.com/doc/current/cookbook/web_server/built_in.html