简体   繁体   English

使用PHPStorm 7.1.3设置Symfony2无法正常工作

[英]Setting up Symfony2 with PHPStorm 7.1.3 not working

I am trying to setup Symfony2 with PHPStorm 7.1.3 using these instructions but I am running into an error when i execute php app/console server:run . 我正在尝试使用这些说明使用PHPStorm 7.1.3设置Symfony2,但是当我执行php app/console server:run

The error I see is 我看到的错误是

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

在此处输入图片说明

This is what my development machine has 这就是我的开发机器所拥有的

WAMP: 2.5
PHP : 5.5.12
OS  : Windows 7

So after getting this error I went to google to do some search and saw many people who had similar problem were using PHP 5.3 and the command line was built for PHP5.4 on wards. 因此,在收到此错误后,我去了google进行搜索,发现许多有类似问题的人都在使用PHP 5.3,并且在病房中为PHP5.4构建了命令行。 I then installed a new version of WAMP which came with PHP 5.5.12 assuming and hoping the error to go away and let me move on to development but then I got the same error again. 然后,我安装了PHP 5.5.12附带的WAMP新版本,并假设错误消失了,让我继续进行开发,但随后又遇到了相同的错误。 Now something tells me may be I did not configure something right so I went to see the PHP settings and all seems fine to me. 现在有些事情告诉我,可能是我没有正确配置某些东西,所以我去查看了PHP设置,对我来说一切似乎都很好。 在此处输入图片说明

I am not sure what else to do to get it to work, I will really appreciate if anyone can guide me in setting up Symfony2 with PHPStorm. 我不确定还有什么其他方法可以使它正常工作,如果有人可以指导我使用PHPStorm设置Symfony2,我将不胜感激。

UPDATE: 更新:

I ran a command php -v to double the php version and it says PHP 5.3.13 我运行了一个命令php -v以使php版本加倍,并显示PHP 5.3.13 在此处输入图片说明

You are clearly using Terminal and not Command Line Tools (CLT). 显然是在使用终端,而不是命令行工具(CLT)。 The manual you are referring to was made for older version where terminal was not yet available and it refers to CLT (which you are NOT using). 您所参考的手册是针对尚未提供终端的较旧版本制作的,它所指的是CLT(您未使用)。

Since you are using Terminal, make sure that your system-wide PHP is actually v5.5. 由于使用的是Terminal,因此请确保系统范围的PHP实际上是v5.5。 You can verify this by executing php -v command. 您可以通过执行php -v命令来验证这一点。

Terminal and "Command Line Tool Support" plugin are two different things. 终端和“命令行工具支持”插件是两个不同的东西。 First is the same as your real console/terminal (eg cmd.exe on Windows) .. while second is some custom emulator (don't know better word/term) which can use PHP Interpreter from PhpStorm settings if configured accordingly (as per manual). 第一个与您的实际控制台/终端(例如Windows上的cmd.exe )相同。.第二个是一些自定义仿真器(不知道更好的词/术语),如果进行了相应的配置,则可以使用PhpStorm设置中的PHP Interpreter手册)。


If you want to use Command Line Tools: 如果要使用命令行工具:

It is located at Tools | Run Command... 它位于Tools | Run Command... Tools | Run Command... . Tools | Run Command...

Make sure that you have created php alias (as per that manual) so it refers to currently select PHP Interpreter from IDE settings. 确保已创建php别名(按照该手册),以便它引用当前从IDE设置中选择的PHP Interpreter。 Otherwise php command may fail. 否则php命令可能会失败。 Aliases can be configured at Settings | Command Line Tool Support 别名可以在Settings | Command Line Tool Support配置Settings | Command Line Tool Support进行配置。 Settings | Command Line Tool Support . Settings | Command Line Tool Support


If you want to use Terminal: 如果要使用终端:

You have 2 choices here: 您有2种选择:

  1. Use FULL path to correct php.exe instead of just php 使用完整路径更正php.exe而不只是php
  2. Make php v5.5 default system-wide. 使php v5.5在系统范围内默认。 For this you have to: 为此,您必须:
    • Alter your PATH environment variable ( My Computer | Right click | Properties | Advanced System Settings | Advanced | Environment variables... ) and place folder where correct PHP 5.5 is located in front of the list 更改PATH环境变量(“ My Computer | Right click | Properties | Advanced System Settings | Advanced | Environment variables... ),并将文件夹放置在列表前面的正确PHP 5.5位置。
    • Restart IDE (most likely will be required) so it picks up these changes to environment variables. 重新启动IDE(很可能需要),以便它对环境变量进行这些更改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM