Executing Php Files

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
s2009
Forum Newbie
Posts: 20
Joined: Thu Apr 30, 2009 1:20 am

Executing Php Files

Post by s2009 »

How to execute PHP files?

Is apache server mandatory to be installed while working with PHP?

Please help me out with the above doubt.

Thanks in advance!!
Reply With Quote
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Executing Php Files

Post by requinix »

Command line: php -f filename

A web server is not necessary.
s2009
Forum Newbie
Posts: 20
Joined: Thu Apr 30, 2009 1:20 am

Re: Executing Php Files

Post by s2009 »

Thanks a lot for ur prompt reply.

Which command prompt?

Is it Ms-Dos Command Prompt?

Because while installing php Designer 2008 i did not get any Command Prompt?

What should I do?

Please help me.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Executing Php Files

Post by requinix »

Yes, the command prompt, but it doesn't have to be used that way.

You know Start -> Run? If PHP is installed to C:\PHP then you can run

Code: Select all

C:\PHP\php.exe -f [i]full path to your .php file[/i]
s2009
Forum Newbie
Posts: 20
Joined: Thu Apr 30, 2009 1:20 am

Re: Executing Php Files

Post by s2009 »

Hi

When I open the file in the command prompt by doing the following:
Start---> Run

"C:\Program Files\phpDesigner 2008\PHP\php.exe"

It is displaying a empty command prompt window.

Now here in the empty window I type the following:

-f D:\AAA\one.php

Once I press enter nothing happens just the cursor is moved one step down.

Now What should I do to run the file?
Mark Baker
Forum Regular
Posts: 710
Joined: Thu Oct 30, 2008 6:24 pm

Re: Executing Php Files

Post by Mark Baker »

Start---> Run

"C:\Program Files\phpDesigner 2008\PHP\php.exe -f D:\AAA\one.php"


If you don't have the -f etc on the same line, you're going into an interactive mode where PHP expects you to type in the code by hand in that "empty window"
s2009
Forum Newbie
Posts: 20
Joined: Thu Apr 30, 2009 1:20 am

Re: Executing Php Files

Post by s2009 »

Thank you

Then should I write the entire coding over here?

If yes then after writing the coding how should I save it?

And how to execute it?

Please help me
Post Reply