Taking web design to the next extreme
By Red Squirrel
If you are running a windows server, it is quite tough to get it to work, and don't expect it to work well once it's working. (this IS windows we are talking about). For windows, I recommend you get a bundle package called Easy php so you don't have to go through trying to install it manually. It is an outdated version of php, but it works for a test server. But if you have the cash to build a dedicated server that will be used for only that and not worry about it's use (ex: parents' computer), no use having windows - put on a good Linux distro on it and install php and apache. I recommend Red Hat or Mandrake, especially if you're a Linux newbie like me.
PHP is often seen with mysql, it is recommended to have mysql as well. Most php scripts also require mysql to store data. But if all you are planning to do is program your own scripts, you can make them use file databases instead. MySql is simply another server side installation like php, but for databases. For example, here at Iceteks our forum is run by php, and the actual posts and other data is stored in a mysql database, including the currency info of the cybervillage. But it could also be put in files if it would have been programmed that way, by mysql is much more organized and fast which is why it is used for big applications such as forums.
When looking for a place to host a website, make sure you get php and mysql. If you're going to pay, you might as well get those features + more. Stay away from Microsoft servers; go with Linux and Apache. There's a windows version of apache, but it's still best to stick with Linux if you can.
Let's get coding!
Now that we are all set with a server and that you know more what php is, we'll move to coding. What's nice about php is that even though you are coding php, you can still code html. The php parser on the server will only parse php if you tell it to. To tell it, you simply put this:
Anything outside of that is not parsed but simply sent directly to the client as it is. You can have as many php code parts as you want in your page. Also, in your apache configuration file, you can decide what file extensions will parse though php. If you plan to use php allot, you might as well add in .html and .htm so that even if you put php code in a .htm/.html file, it will still parse it. Parsing is simply the word used to say that the php is executed by the server and the execution result is sent to the client.
Our first script
Here is a simple script written with php:
If you upload this to your server and open it, you should get the text "hello world". Also, two different type of comments have been added to show you how you can add comments to your code for your own needs. The first one is for single line comments, while the second one can be used for longer comments that take up more then one line.
You may ask yourself what the point of php is, since sure you can easily skip the php stuff and just write "hello world" and still get the same result. The next page will explain this to you, since there's WAY more to php then the echo() function!
This site best viewed in a W3C standard browser at 800*600 or higher
Site design by Red Squirrel | Contact
© Copyright 2019 Ryan Auclair/IceTeks, All rights reserved