
This guide is meant for absolute beginners to PHP; someone who's already familiar with regular HTML and CSS, and is willing to take his websites to the next level. PHP is server-side scripting which means that the code is executed at the server before it reaches a browser. This also means that our first step will be setting up a type of server on your home PC.
We'll be using XAMPP for windows, download it here: http://www.apachefriends.org/en/xampp-windows.html and install.
With standard HTML web pages, you would access your HTML file in your browser using the same path that you would in the directory explorer (e.g. C:\documents and settings\etcc\yourhtmlfile.html). It's slightly different with PHP. In your browser, you will access the root directory of your website by going to http://localhost/, do that after you've installed XAMPP to see if everything's working OK. You should be taken to a welcome screen.
In the directory explorer, you'll have to go to your XAMPP installation folder and into a folder called htdocs. This is the base directory for your website. Sub-directories will work in here as expected. Find the index files (html, php) and rename them to something else, and create your own index.php. You can now start creating your home page using HTML and CSS as you would for regular HTML pages, the difference is that it's now PHP ready.
I will not go into a PHP coding tutorial in this article, but try out a simple hello world by putting the following in between the <body> tags:
<?php
echo 'Hello World';
?>
Remember, to see any PHP enabled pages, you have to point your browser at http://localhost/. By the way, you also have a MySQL database engine packaged with your XAMPP installation. This means you're ready to go with PHP. Find some beginner's tutorials, or wait until I have some time to post one myself here, only at WebGuruGuide.com.
Enjoy!
- Ralph van den Berg
http://ralphvandenberg.com