Jump to content

Total Newbie Question


sjs94704

Recommended Posts

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
 
Link to comment
Share on other sites

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.

  1. First off, in Notepad++ look in the top menu for "Plugins".
  2. From there you should see in the dropdown menu "NppFTP"
  3. 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:

  1. Click the Setting icon in the NppFTP window/area.
  2. Choose "Profile Settings".
  3. Click "Add new" in bottom left corner.
  4. 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.

Link to comment
Share on other sites

 

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!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.