I am new for PHP language
I dont know how to run PHP files on out machine
so please anyone tell me
how to do it
thanks

Recommended Answers

All 9 Replies

You may run PHP scripts as console applications, which is much simpler then installing full blown server on your computer. Download and unpack php somewhere, find php.exe and run it with your file.php as parameter, from command line (cmd). C:\PHP\php.exe -f file.php On linux distros install it from your distro repository and run it same way without path also from command line. php -f file.php Running in console app mode you may familiarize yourself with language, try out constructs, functions and pretty much every extension. There are limitations howewer, you cant do requests as in server, some variables will not be available (_GET, _POST, ...). But it doesn't matter now.

Member Avatar for diafol

You may run PHP scripts as console applications, which is much simpler then installing full blown server on your computer.

I hate to disagree, but XAMPP (which will install Apache web server, MySQL, pHp) may be easier in the long run.

You may run PHP scripts as console applications, which is much simpler then installing full blown server on your computer. Download and unpack php somewhere, find php.exe and run it with your file.php as parameter, from command line (cmd).
C:\PHP\php.exe -f file.php

well kudos to you.. it ran and i got the output . (obviously i just printed statemet)
now if i want to create a proper file .. then how do i do that , i mean accept the data from the file i have built.

Hello Rahul,

Hope you are doing well, if you are using windows OS, install WAMP Server for all your development. It will help you alot in the future. Because it is very helpful for you as a beginner, as you don't have to worry about the details.

And while question about learning php, http://php.net and http://www.w3schools.com will be very helpful to you. I hope it will help you.

For any query, first search on Google, you will find READY MADE solutions to your problems. If this helped you, add it to my reputation. Thanks.

well kudos to you.. it ran and i got the output . (obviously i just printed statemet)
now if i want to create a proper file .. then how do i do that , i mean accept the data from the file i have built.

I have a phpIDE, DevPHP, off sourceforge,
it provides a syntax highlighting editor and runtime browser in one package
a one file install like a subset of wamp/lamp

well as of now i have installed wamp. in my system . so how do i run these php scripts into it.

Member Avatar for diafol

I haven't got experience with WAMP, but if its similar to XAMPP, you should have a htdocs subdirectory under the main WAMP directory. If you place your files in here, you should be able to access them via: http://localhost/myfile.php. Setting up a number of local websites - search for 'vconf'/Apache/Windows.

well i can access like that... it completly runs as
http://localhost/myfile.php not a problem. but i guess my scripts have problem..

and debugger for this php scripts available........

Member Avatar for diafol

well i can access like that... it completly runs as
http://localhost/myfile.php not a problem. but i guess my scripts have problem..

and debugger for this php scripts available........

Get Notepad++ text editor (free download) or you can get an IDE like AlmostBob mentions or 'Aptana' (also free).

If you've got a syntax error, you should get an error message to the screen. php doesn't pick up all errors, so a code highlighter (like Notepad++) could be useful here.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.