使用 symfony 時 PHP 5.5 無法識別服務器 (PHP 5.5 won't recognise server when using symfony)


問題描述

使用 symfony 時 PHP 5.5 無法識別服務器 (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 版本php ‑v,與 php app/check.php 顯示相同的版本 php 5.5.27,有什麼見解嗎?

我用 symfony‑installer 安裝 symfony ,並且 php 已經安裝在我的機器上。

即使我運行 $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

它不會顯示服務器命令:(


參考解法

方法 1:

You run Symfony Version 2.0 its too old. Upgrade to the latest version or the LTS version first then you have the server command. Otherweise you can't use them.

The command server:run is for version 2.3 after on higher versions its server:start

here is the manual

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

(by erickshoRené Höhle)

參考文件

  1. PHP 5.5 won't recognise server when using symfony (CC BY‑SA 2.5/3.0/4.0)

#php-5.5 #symfony






相關問題

當作為參數傳遞時,PHP 如何解釋和評估函數和匿名函數? (How does PHP interpret and evaluate function and anonymous function when passed as an argument?)

使用 symfony 時 PHP 5.5 無法識別服務器 (PHP 5.5 won't recognise server when using symfony)

升級到 PHP5.5 時 Wordpress 崩潰 (Wordpress crashes when upgrading to PHP5.5)

從數據庫返回多個值 (return multiple values from database)

PHP:嵌套 foreach 循環的問題 (PHP: Issue with nested foreach loops)

如果條件在幾小時、幾天內不起作用 (if condition not working for Hours,Days)

Slim 3.3 輸出中缺少字符 (Slim 3.3 missing characters in output)

PHP排序對象值但保留原始相對順序 (PHP sort objects value but retain original relative order)

遇到錯誤無法加載請求的文件:helpers/form_validation_helper.php (An Error Was Encountered Unable to load the requested file: helpers/form_validation_helper.php)

如何從類的函數內部訪問全局變量 (How to access global variable from inside class's function)

如何修改輸出緩衝區? (How to modify output buffer?)

在同一台 Ubuntu 服務器上安裝和配置 PHP5 和 7 (Install and configure PHP5 and 7 on same Ubuntu server)







留言討論