sjs94704 Posted March 3, 2013 Share Posted March 3, 2013 OK Folks: I am totally starting fresh with learning PHP starting with my first program that simply says "Hello World" So, I've been watching a really cool video on YouTube that has been showing me how to write PHP code and as with any programming language, the first thing you learn is how to print the words "Hellow World" in the browser. Anyway, so I have the following program, written in NotePad++: <?PHP print "Hello World"; ?> But, when I tell NotePad++ to launch the code in Chrome, instead of showing me just the words Hello World, it displays the entire code I wrote on the page as: <?PHP print "Hello World"; ?> This is NOT the desired result. Also, in NotePad++, I want to upload this file to my web site, I see where there is an upload button, but it is not enabled to allow me to upload this test program to my site. I'm stuck!!! Any suggestions ? Thanks, Steven Schuyler Berkeley, CA Quote Link to comment https://forums.phpfreaks.com/topic/275188-total-newbie-question/ Share on other sites More sharing options...
BorysSokolov Posted March 3, 2013 Share Posted March 3, 2013 Check if the file has a proper extension (should be .php), and also, I believe you should use "echo" instead of "print", it's faster. Quote Link to comment https://forums.phpfreaks.com/topic/275188-total-newbie-question/#findComment-1416298 Share on other sites More sharing options...
cutielou22 Posted March 3, 2013 Share Posted March 3, 2013 Also, in NotePad++, I want to upload this file to my web site, I see where there is an upload button, but it is not enabled to allow me to upload this test program to my site. On Notepad++ you can use FTP to automatically upload and edit files on your website. First off, in Notepad++ look in the top menu for "Plugins". From there you should see in the dropdown menu "NppFTP" Hover over that and click "Show NppFTP Window". That will add it to the screen - if not already showing. Now to add your FTP details do the following: Click the Setting icon in the NppFTP window/area. Choose "Profile Settings". Click "Add new" in bottom left corner. Now enter your FTP details. If you do not know this information you will need to go to your webhost and find something like "FTP details" in your cpanel. Also: .php files will show the coding. Change the file to .html if you want to test the result. Quote Link to comment https://forums.phpfreaks.com/topic/275188-total-newbie-question/#findComment-1416303 Share on other sites More sharing options...
Drongo_III Posted March 3, 2013 Share Posted March 3, 2013 OK Folks: I am totally starting fresh with learning PHP starting with my first program that simply says "Hello World" So, I've been watching a really cool video on YouTube that has been showing me how to write PHP code and as with any programming language, the first thing you learn is how to print the words "Hellow World" in the browser. Anyway, so I have the following program, written in NotePad++: <?PHP print "Hello World"; ?> But, when I tell NotePad++ to launch the code in Chrome, instead of showing me just the words Hello World, it displays the entire code I wrote on the page as: <?PHP print "Hello World"; ?> This is NOT the desired result. Also, in NotePad++, I want to upload this file to my web site, I see where there is an upload button, but it is not enabled to allow me to upload this test program to my site. I'm stuck!!! Any suggestions ? Thanks, Steven Schuyler Berkeley, CA You should probably download an ftp program such as filezilla to push files to your server - never used notepad++ for it but I wouldnt trust the results tbh. Also, to my knowledge, you cannot execute php code without a server. If you want to run php code locally you'll need to download something like WAMP server (http://www.wampserver.com/en/) which you can install and run as a server on your computer. This will then let you execute your php scripts. WAMP is insanely easy to install. Hope that helps! Quote Link to comment https://forums.phpfreaks.com/topic/275188-total-newbie-question/#findComment-1416304 Share on other sites More sharing options...
haku Posted March 4, 2013 Share Posted March 4, 2013 That's correct. PHP files need to be passed through a parser before they will executed. Opening up a .php file in your browser simply opens that file prints the text inside to the screen. If you want to execute the PHP, you run it through a server. If you are windows you can use WAMP, on a Mac, you can use MAMP. or on either (and Linux I believe) you can run xxamp. All of these install servers onto your local system so that you can run PHP on your local computer instead of having to push it to the server to test. Quote Link to comment https://forums.phpfreaks.com/topic/275188-total-newbie-question/#findComment-1416358 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.