简体   繁体   English

PhpStorm通过Composer设置项目时“通往php的空路径”

[英]PhpStorm “empty path to php” when setting up project through Composer

I am following along with a Laracast ( https://laracasts.com/series/how-to-be-awesome-in-phpstorm/episodes/21?autoplay ) and when I try to set up a new Laravel project using Composer, as taught in the tutorial, I am unable to complete the dialog due to an error message stating "Empty path to php". 我跟随一个Laracast( https://laracasts.com/series/how-to-be-awesome-in-phpstorm/episodes/21?autoplay ),当我尝试使用Composer设置一个新的Laravel项目时,正如教程中所教导的,由于错误消息指出“php的空路径”,我无法完成对话框。

I have the path to PHP set properly, and am able to run and debug through PhpStorm. 我有正确设置PHP的路径,并且能够通过PhpStorm运行和调试。 If someone can help me understand what's going on here, I'd appreciate it. 如果有人能帮我理解这里发生的事情,我会很感激。 I have searched Google and only found one result, which was for Windows, not Mac. 我搜索过Google,但只发现了一个结果,这个结果适用于Windows,而非Mac。 ( https://devnet.jetbrains.com/thread/475384 ) https://devnet.jetbrains.com/thread/475384

我所看到的截图

As you can see from your screenshot the "New Composer Project" screen does not have any option to select the PHP Interpreter that is required to actually launch composer (that's how PhpStorm works -- the same approach for all supported OS: Linux, Mac and Windows). 从截图中可以看出,“New Composer Project”屏幕没有任何选项可以选择实际启动composer所需的PHP解释器(这就是PhpStorm的工作原理 - 所有支持的操作系统都采用相同的方法:Linux,Mac和视窗)。

The workaround is to choose default PHP Interpreter in Default Settings (settings that would be used for any future new project created on this machine) -- this way you will have PHP Interpreter already pre-selected even for this kind of new project. 解决方法是在默认设置中选择默认的PHP解释器(将用于在此机器上创建的任何未来新项目的设置) - 这样,即使对于这种新项目,您也将预先选择PHP解释器。

You need to use File | Default Settings 你需要使用File | Default Settings File | Default Settings to set such default PHP Interpreter there (well, that's on Windows/Linux -- on Mac it could be at some different location in menu). File | Default Settings在那里设置这样的默认PHP解释器(好吧,那是在Windows / Linux上 - 在Mac上它可能在菜单中的某个不同位置)。 If you do not have any projects opened you still can access such Default Settings from Welcome screen. 如果您没有打开任何项目,您仍然可以从欢迎屏幕访问此类默认设置。

Note: If you are still seeing same error after setting PHP Interpreter, then try restarting PhpStorm -- should help. 注意:如果在设置PHP解释器后仍然看到相同的错误,请尝试重新启动PhpStorm - 应该有所帮助。


Note that In current 2016.x versions you can also specify what PHP Interpreter to use (and create new one if needed) at the bottom of this New Project screen -- it has Settings section which you can unfold -- just scroll the window down a bit to see it. 请注意 ,在当前的2016.x版本中,您还可以在此新建项目屏幕的底部指定要使用的PHP解释器(并在需要时创建新的解释器) - 它具有可以展开的Settings部分 - 只需向下滚动窗口有点看。

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

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