Freedom The Open Source Way Contribute Articles or News to OSForgeOSForge HomeLogout from Forums
Contacting OSForgeOSForge HomeAbout OSForge
  

Root
Contribute News
Learning Corner
Linux Distributions
Linux Common FAQ's
Discussion Forums
Community Gallery
Links Directory
Search OSForge
Networking
Industry Updates
Linux & Open Source
Opinions
Press Release
Programming
Security
Web Development

White Paper
Likewise Cross-Platform Integration Software Hits 100,000 Users
Cloud.com Releases New Version of CloudStack
CeBIT 2011: Zarafa Sets New European Open Source Groupware Standard
Open-Xchange Partners to Bring Cloud-Based E-mail Integration with Salesforce.com
Dell Customers Use Ubuntu to Deploy Cloud
London's Design Museum Recognizes Ubuntu Fonts
Canonical announces Ubuntu Developer Day
Capgemini Enters into an Alliance with Six Open Source Vendors
Liferay Releases LESA to Enterprise Customers
Zarafa Announces SiMKo 2 Support and a New S/MIME WebAccess Plugin

View More »

What is PHP and what does it do?
  [Printable Version]



This article will give you a fast track of what PHP is and what it does. It does not explain very much about the coding yet but gives some sort of brief explanation of the language. Your feedback is very valuable on this one especially. Please post your comments and suggestions under this article on what my mistakes were and what you want to see in next articles.

Introduction in PHP

PHP4? It looks like just some letters and numbers combination for a regular user. But we are here to be above the simple user mind, right? PHP4 is the latest incarnation of PHP - the "PHP Hypertext Preprocessor". PHP is a programming language that is widely used for building dynamic, interactive web sites, originally devised by Rasmus Lerdorf way back in 1994. Since then, language has gone trough the numerous of changes and has been adopted by webmasters all over the world. PHP has a lot of advantages of the other computer languages for writing dynamic web sites:

  • Multi-Platform - you can run a PHP on computers that are running many different operating systems. For example, PHP script that runs on Linux will generally run on Windows as well.
  • HTML embedded - PHP code is written as a mixture of HTML and PHP code.
  • Server-side - PHP runs only on the server machine.
  • A web scripting language - Users run PHP via the browser.

The most amazing thing is that we are going to write programs that mix PHP4 code and HTML together, that, as you will see later produces the terrific results! PHP is like a very powerful add-on to PHP that enriches HTML's abilities enormously. The only thing that I want to say before we start the basics of PHP, that although language will contain a lot of HTML tags I am not going to go into the deep explanations of it. The HTML tutorials will be out probably pretty soon. Or, if you don't want to wait, you can look for it on other web sites.

Ok, let's start from... That's right installation. Yes, yes... At first you will have to install it on your computer at first. How are we going to test our programs without it? To test your scripts you will have to install your web server. If you are running windows the best way is to install PWS (Personal Web Server) for Win95/98/Me or IIS for WinNT/2000. Both programs can be found on http://www.microsoft.com, or on the OS installation cds. After you will finish with web server you will need to add a php support to it. Actually the installation is not very complicated and the tutorials from http://www.php.net are very explanatory. The installation files can be downloaded from http://www.php.net/downloads.php. If you will get some questions regarding the installation process, please, don't hesitate to post them on my forum. I will help as fast as I can.

Ok, I hope you have installed the PHP by now and is ready for some real coding. Oh, almost forgot. We need to test the PHP if it works. You will need to write a very short program for that. Let's try:


This should bring the page with all PHP information of your server. If nothing has happened than your PHP does not work. But let's be optimistic and assume everything works. Now it is the time for our first program. Let's say famous 'Hello World'. To write programs you can use notepad, phpED, or even DreamWeaver. Open your editor and write:

echo "Hello World";
?>

Save it in your web server's directory as hello.php and run it from the browser. You should see the phrase "Hello World" (without ""). If you see your code than your PHP does not work. This is a very short code but it introduces a first command and a basics of PHP syntaxes. Echo sends a command to browser to display something, in this case the phrase 'Hello World'.

Ok, you wrote your first program. In next article I will explain some basics commands and actions. And now you can relax for a while and post your comments about this article.

My first introductory PHP article. It does not explain very much about the coding yet but gives some sort of brief explanation of the language. Your feedback is very valuable on this one especially. Please post your comments and suggestions under this article on what my mistakes were and what you want to see in next articles.

  

[ Back to Programming & | Sections Index ]

 
Scroll Up

   About | Term of Use | Privacy | Adras | Tell a Friend | Advertise  

OSForge News RSS Feed