Jump to content

How I Can Execute Php Program


Alexancho

Recommended Posts

Apache isn't needed to run PHP, but he said he already downloaded Wamp. If so, you need to figure out where your web root is and save your file there. Check the documentation for wamp to see where it puts the web root, it may be somewhere inside Program Files. Save your PHP file into the web root, and then you can access it over HTTP like Redroest showed.

Link to comment
Share on other sites

Thank you very much.It works. I created a folder inside root folder for my php files and run them on localhost.But for that i need to write the address in address bar of a browser or create a link.Is there an easier ways to run PHP files like we have for html files?And could you recommend me a PHP Editor?

Link to comment
Share on other sites

Once you get WAMP running, you can left-click the icon and click on localhost as quick link. You can find many text-editors here.

Link to comment
Share on other sites

Once you get WAMP running, you can left-click the icon and click on localhost as quick link. You can find many text-editors here.
Yes. Of course, you are right, but this way you can only open http://localhost/ in your browser.For example, if i have 20 html files in some folder i can open them one by one by double click or by simple drag and drop. If i have 20 php files in folder my_test i should write in an address bar something like this:http://localhost/my_test/test1.php and change it manually 19 times or to create an html file with 20 links.The question is whether there is a better method?
Link to comment
Share on other sites

Are you talking about browsing to files while in your localhost?You can get a directory listing of all the files you have inside a certain folder if you do not have an index page in that folder. WAMP by default is set to show directory listings if no index page is found. Here's what I mean:browsefiles.jpg

Link to comment
Share on other sites

Well thats the downside of making serversided systems I guess. unlike html, php is a programming language. This means that php is able to output the html pages. html is a markup-language for your browser and javascript is a client-side language it means that the data is already send to YOU (the client) and is ready to display on your browser. php can't display itself, it can only output things to display.Please correct me if I am wrong about this, but I am working with this philosophy since I program php.

Link to comment
Share on other sites

Redroest, that's true, but your missing some important details. You can view regular html files by directly clicking on them without the need for it to go through a server because HTML, CSS, and JavaScript are all processed by the client-side (AKA your browser). PHP is server-side, your browser doesn't know how to process server-side code, so if you try to view a PHP file with PHP code in it without going through a server, the browser will try parse the PHP code as html or text making the PHP code spill all over your page. PHP will simply output the end result of whatever your PHP code was doing.You can just use WAMP as your development server for everything now, including regular HTML files. You can get quick access to these files through the previous method I mentioned.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...