Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » PHP Development Tools (PDT) » RUN as PHP CLI(Run PHP scripts without web server?)
RUN as PHP CLI [message #1717337] Fri, 11 December 2015 21:10 Go to next message
Anna Harris is currently offline Anna HarrisFriend
Messages: 1
Registered: December 2015
Junior Member
Eclipse and PDT installed
PHP installed
PHP executable path set up in eclipse (c:\php)
Just want to run simple hello world scirpt without setting up web server.

When I Run As - PHP CLI application nothing happens.

I would expect it to do like java and find the php.exe and spit the output into the console. I can run the script from the command prompt c:\php\php.exe helloworld.php fine. Can't I do this in eclipse?

Why is this so hard?

Thanks
Re: RUN as PHP CLI [message #1717513 is a reply to message #1717337] Mon, 14 December 2015 13:57 Go to previous messageGo to next message
Ilya Glazkov is currently offline Ilya GlazkovFriend
Messages: 4
Registered: December 2015
Junior Member
Please show you code.
Re: RUN as PHP CLI [message #1717551 is a reply to message #1717513] Mon, 14 December 2015 16:35 Go to previous messageGo to next message
Mark Dexter is currently offline Mark DexterFriend
Messages: 324
Registered: July 2009
Senior Member
If you go into Windows->Preferences->PHP->PHP Executables, do you have a PHP Executable set up? If not, add one there and then it should work. Good luck.
Re: RUN as PHP CLI [message #1720820 is a reply to message #1717551] Thu, 21 January 2016 09:25 Go to previous messageGo to next message
Anurag Agrawal is currently offline Anurag AgrawalFriend
Messages: 1
Registered: November 2015
Junior Member
look for lines that starts with LoadModule php... There propably is configuration files/directories named mods or something like that, start from there.

You could also check output from php -r 'phpinfo();' | grep php and compare lines to phpinfo(); from web server.
To run php interactively

so you can paste/write code to console run it with:

php -a

To make it parse file and output to console:

php -f file.php

Parse file and output to another file:

php -f file.php > reults.html
Re: RUN as PHP CLI [message #1723833 is a reply to message #1720820] Thu, 18 February 2016 10:48 Go to previous messageGo to next message
Ramanjeet Singh is currently offline Ramanjeet SinghFriend
Messages: 1
Registered: February 2016
Junior Member
Hi
I am agree with "Mark DexterFriend" but its better if you show your code here
Thanks
Re: RUN as PHP CLI [message #1723949 is a reply to message #1723833] Fri, 19 February 2016 08:28 Go to previous message
falka Brar is currently offline falka BrarFriend
Messages: 1
Registered: February 2016
Junior Member

It's worth adding that PHP from version 5.4 onwards is able to run a web server on its own. You can do it by running this code in a folder which you want to serve the pages from:

$ php -S localhost:8000
Previous Topic:Postgres and PDT
Next Topic:Eclipse freezes when browsing PHP Explorer
Goto Forum:
  


Current Time: Sat Nov 09 00:50:08 GMT 2024

Powered by FUDForum. Page generated in 0.03731 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top