Missing "Run as... PHP Script" in Eclipse
Asked Answered
C

2

6

I have Eclipse 4.2 (Juno) + PDT 3.1.1 freshly installed and i've selected PHP perspective. I've created empty "Test Project" PHP project and added "test.php" file to it. Now i want to run this file as PHP Script. But i simply don't have it in my "Run as..." context menu when i right click on "test.php" file. Please help. I am exhausted.

Additional information:

  • I have php5 installed on my PC and i can run .php files in my Windows command line window using "php filename.php" syntax.

  • I've tried same thing in so-called "All-in-one" Eclipse+PDT package. Same problem.

Creamcups answered 30/7, 2012 at 17:24 Comment(0)
R
8

Go to Preferences>PHP>Debug, check "Enable CLI Debug" on.

Reindeer answered 31/7, 2012 at 0:2 Comment(1)
09.2020 eclipse: this option doesn't exist.Overboard
H
-2

You don't need to "run" your PHP files through Eclipse (or any IDE, for that matter). You can just as easily debug by temporarily printing the values of variables you're trying to inspect to the page. Just open your browser and navigate to the file (e.g.: localhost/[page]?[querystring]).

Remember, PHP is an interpreted language, not a compiled language (such as Java or C#) so you don't have to "run" it from anywhere in particular. As long as your server is set up to process php files, you can view them through a browser.

Use the IDE for its code-completion features and to speed up development (as opposed to using a bare-bones text editor). Test in a browser.

Harve answered 30/7, 2012 at 17:27 Comment(5)
I understand. But among features you pointed about IDE i want to see output of my php file in output box of Eclipse. I don't want to use browser.Creamcups
If you don't mind me asking, why don't you want to use the browser? That's where your output will be displayed in the end, isn't it? You're not going to have people visiting your site via Eclipse.Harve
Sure i can tell. I am not writing something that will be viewed in browser. I am doing implementation of hierarchical structure using relational database model (MySQL). And what i want is to be able rapidly check if my code works OK.Creamcups
I've always found that hitting F5 is pretty rapid, but to each his own. This is more of an IDE issue, though - not PHP.Harve
The question specifically asked how to do this in Eclipse and not if we need an IDE or if we can do everything in a text editorWageworker

© 2022 - 2024 — McMap. All rights reserved.