x10Hosting Forums

Corporate Free Hosting for the Masses.



Register

Reply
 
LinkBack Thread Tools Display Modes
x10 Sophmore

o0slowpaul0o's Avatar

Join Date: Mar 2005
Posts: 127
Credits: 226
o0slowpaul0o is on a distinguished road
Send a message via MSN to o0slowpaul0o Send a message via Yahoo to o0slowpaul0o
Quote  
08-14-2005, 07:36 AM
Unstand PHP?

Your first PHP-enabled page
Create a file named hello.php and put it in your web server's root directory (DOCUMENT_ROOT) with the following content:

????? 2-1. Our first PHP script: hello.php

Code:
<html>
 <head>
  <title>PHP Test</title>
 </head>
 <body>
 <?php echo '<p>Hello World</p>'; ?>
 </body>
</html>
Use your browser to access the file with your web server's URL, ending with the "/hello.php" file reference. When developing locally this URL will be something like http://localhost/hello.php or http://127.0.0.1/hello.php but this depends on the web server's configuration. If everything is configured correctly, this file will be parsed by PHP and the following output will be sent to your browser:
Code:
<html>
 <head>
  <title>PHP Test</title>
 </head>
 <body>
 <p>Hello World</p>
 </body>
</html>



This program is extremely simple and you really did not need to use PHP to create a page like this. All it does is display: Hello World using the PHP echo() statement. Note that the file does not need to be executable or special in any way. The server finds out that this file needs to be interpreted by PHP because you used the ".php" extension, which the server is configured to pass on to PHP. Think of this as a normal HTML file which happens to have a set of special tags available to you that do a lot of interesting things.

If you tried this example and it did not output anything, it prompted for download, or you see the whole file as text, chances are that the server you are on does not have PHP enabled, or is not configured properly. Ask your administrator to enable it for you using the Installation chapter of the manual. If you are developing locally, also read the installation chapter to make sure everything is configured properly. Make sure that you access the file via http with the server providing you the output. If you just call up the file from your file system, then it will not be parsed by PHP. If the problems persist anyway, do not hesitate to use one of the many PHP support options.

The point of the example is to show the special PHP tag format. In this example we used <?php to indicate the start of a PHP tag. Then we put the PHP statement and left PHP mode by adding the closing tag, ?>. You may jump in and out of PHP mode in an HTML file like this anywhere you want. For more details, read the manual section on the basic PHP syntax.

A Note on Text Editors: There are many text editors and Integrated Development Environments (IDEs) that you can use to create, edit and manage PHP files. A partial list of these tools is maintained at PHP Editors List. If you wish to recommend an editor, please visit the above page and ask the page maintainer to add the editor to the list. Having an editor with syntax highlighting can be helpful.

A Note on Word Processors: Word processors such as StarOffice Writer, Microsoft Word and Abiword are not optimal for editing PHP files. If you wish to use one for this test script, you must ensure that you save the file as plain text or PHP will not be able to read and execute the script.

A Note on Windows Notepad: If you are writing your PHP scripts using Windows Notepad, you will need to ensure that your files are saved with the .php extension. (Notepad adds a .txt extension to files automatically unless you take one of the following steps to prevent it.) When you save the file and are prompted to provide a name for the file, place the filename in quotes (i.e. "hello.php"). Alternatively, you can click on the 'Text Documents' drop-down menu in the 'Save' dialog box and change the setting to "All Files". You can then enter your filename without quotes.

Now that you have successfully created a working PHP script, it is time to create the most famous PHP script! Make a call to the phpinfo() function and you will see a lot of useful information about your system and setup such as available predefined variables, loaded PHP modules, and configuration settings. Take some time and review this important information.

There's....more.
__________________



Last edited by o0slowpaul0o; 08-14-2005 at 07:37 AM.
Reply With Quote
o0slowpaul0o is offlineReport Post
Lead Development

Join Date: Apr 2005
Posts: 3,477
Credits: 20,771
Bryon has a reputation beyond repute
Location: rit/rochester/walton, ny

Quote  
08-14-2005, 03:06 PM
Re: Unstand PHP?

I was thinking about that before... The way it was worded and all.

:-\
__________________
cs.rit.edu/~bce7698/
Reply With Quote
Bryon is offlineReport Post
x10 Sophmore

o0slowpaul0o's Avatar

Join Date: Mar 2005
Posts: 127
Credits: 226
o0slowpaul0o is on a distinguished road
Send a message via MSN to o0slowpaul0o Send a message via Yahoo to o0slowpaul0o
Quote  
08-15-2005, 09:56 AM
Re: Unstand PHP?

I only nicked that part, typing at my own right now. Jusr didn't know how to explain that. ^_^
__________________


Reply With Quote
o0slowpaul0o is offlineReport Post
Lead Development

Join Date: Apr 2005
Posts: 3,477
Credits: 20,771
Bryon has a reputation beyond repute
Location: rit/rochester/walton, ny

Quote  
08-16-2005, 10:32 AM
Re: Unstand PHP?

Still seems a little... "fishy".
__________________
cs.rit.edu/~bce7698/
Reply With Quote
Bryon is offlineReport Post
x10Hosting Member

Join Date: Jul 2005
Posts: 39
Credits: 2,972
bigdbag is on a distinguished road
Location: USA

Send a message via AIM to bigdbag
Quote  
08-17-2005, 02:39 PM
Re: Unstand PHP?

Quote:
Still seems a little... "fishy".
yea, maybe u can cite the page that you used or something. don't do that again please.
__________________
Want flash intros, banners, ads, buttons, full websites, and even blogs? You can pay in points! PM me for prices. I make your product, let you see it in action, and then if you like it, that's when you pay. :grin:

A website made of my previous projects has been mismatched and lumped together for a variety show for you to examine my work.

<A HREF="http://sangdukseo.zoomcities.com">Click here for site</A>
Reply With Quote
bigdbag is offlineReport Post
x10Hosting Member

Join Date: Aug 2005
Posts: 17
Credits: 273
taco| is on a distinguished road
Quote  
08-19-2005, 04:48 PM
Re: Unstand PHP?

You didn't need to take that to explain the echo command. :\
__________________
Reply With Quote
taco| is offlineReport Post
x10 Sophmore

supajason's Avatar

Join Date: Oct 2007
Posts: 236
Credits: 1,463
supajason will become famous soon enough
Location: England........:-)

Send a message via MSN to supajason
Quote  
11-17-2007, 02:32 PM
Re: Unstand PHP?

Looks """a lot""" like http://devzone.zend.com/manual/tutorial.firstpage.html if i do say so myself.
__________________
SuPaJaSoN WaS HeRE
Reply With Quote
supajason is offlineReport Post
x10Hosting Member

nimd4's Avatar

Join Date: Jul 2007
Posts: 7
Credits: 115
nimd4 is on a distinguished road
Quote  
01-07-2008, 09:33 PM
Talking Re: Unstand PHP?

Quote:
Originally Posted by o0slowpaul0o View Post
Unstand PHP?
Understand Unstand?!?? :P j/k
Reply With Quote
nimd4 is offlineReport Post
x10 Lieutenant

coolv1994's Avatar

Join Date: Nov 2007
Posts: 462
Credits: 4,180
coolv1994 will become famous soon enough
Location: Sunbury, Ohio

Send a message via AIM to coolv1994 Send a message via Yahoo to coolv1994
Quote  
01-07-2008, 10:16 PM
Re: Unstand PHP?

phpinfo() isn't allowed on x10.
Anyway nice tutorial but a little legthny.
__________________
If you found me helpful please click the to thank me, credits are also much appreciated.

Reply With Quote
coolv1994 is offlineReport Post
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT -5. The time now is 03:21 PM. Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0 RC7
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios

Online Loans | Online Loans | Internet Advertising | Myspace Layouts | Credit Cards