eclipse 请为此启动设置有效的 PHP 可执行文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13531714/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 19:28:29  来源:igfitidea点击:

Please set a valid PHP executable for this launch

phpeclipse

提问by user758362

I have just started Eclipse for developing PHP. I did the first project in the book and it went great with a bit of help from you all.

我刚刚开始使用 Eclipse 来开发 PHP。我做了这本书中的第一个项目,在你们的帮助下它进行得很好。

Then I opened a second project. While trying to configure the run path (Eclipse always starts out pointing to my server's root), Somehow I got the IDE in a state that I can't get it out of. It pops up a dialog box when I try to run the project with the title "launch error"and in the box it says: "Please set a valid PHP executable for this launch". I think it has something to do with the debugger which I am not using yet. My code is very simple, in file one:

然后我打开了第二个项目。在尝试配置运行路径时(Eclipse 总是开始指向我的服务器的根目录),不知何故我让 IDE 处于无法摆脱的状态。当我尝试运行标题为“启动错误”的项目时,它会弹出一个对话框,并在框中显示:“请为此启动设置有效的 PHP 可执行文件”。我认为这与我尚未使用的调试器有关。我的代码很简单,在文件一中:

<?php 
   include('helloObj.php');
   $hello= new hello();

   $hello->prntMessage();
?>

And in file two:

在文件二中:

<?php 

class Hello {
    var $message;

    function __construct() {
        $this->message= "Hello World!";
    }

    /**
      * Function that prints the value of the instance variable 
      * $message
      */
    function prntMessage() {
        echo $this->message;
    }
}

?>

This was copied off a tutorial on the web (and works just fine in my browser) so I don't think it is the cause.

这是从网络上的教程中复制的(并且在我的浏览器中运行良好)所以我认为这不是原因。

Also, if someone could tell me the recommended way to configure PHP run paths in Eclipse, I would appreciate that too.

另外,如果有人能告诉我在 Eclipse 中配置 PHP 运行路径的推荐方法,我也将不胜感激。

回答by user758362

Do the following:

请执行下列操作:

  1. Run -> Debug Configurations

  2. Chose your PHP Debugger. I chose XDebug

  3. Find your PHP executable (php.exe). In XAMPP it is at C:\xampp\php\php.exe

  4. Point to your PHP file.

  5. Press debug at bottom.

  1. Run -> Debug Configurations

  2. 选择您的 PHP 调试器。我选择了 XDebug

  3. 找到您的 PHP 可执行文件 ( php.exe)。在 XAMPP 中,它位于C:\xampp\php\php.exe

  4. 指向您的 PHP 文件。

  5. 按底部的调试。

The script should run.

脚本应该运行。