I'm just starting to learn and work with PHP/MySQL for dynamic web pages. I am a little confused on one thing: what does the PHP download actually do? I know it's a real newbie question, but what does it allow me to do or not do. I cannot seem to find a good explaination of that anywhere. Another thing once I have it on my machine, then do I have to put it on my site, or does a websever already have that?
Any answer would be appreciated. Thanks.
P.S. Any tips you would care to give to a beginner? Thanks...
In order to process PHP web pages, the webserver needs to route the source page through the PHP parser/compiler. It parses the PHP portions of the page, compiles it, and executes it, adding any output from it to the http output that is sent to the browser as an HTML page. This parser/compiler is what you would download if you want to run PHP web pages on your PC. You also would need to have a webserver set up on your PC. A fairly painless way to do this is to download and install the XAMPP package, which installs Apache websever and MySQL along with PHP.
As far as your web host, you'll have to check with them to see if they support PHP (and MySQL or other database system if needed). A quick way to check is to create a file on your web site with a ".php" suffix (such as "test.php") and have just the following as the contents:
If, when you access that page from your web host, you get a page with all sorts of info about the PHP installation, then PHP is installed and configured on your host. If all you see are the above lines of code, then it is not.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
A fairly painless way to do this is to download and install the XAMPP package, which installs Apache websever and MySQL along with PHP.
So on the internet, my actual web host would be the web server, but on my computer, I need another to do the same thing. This way I can work on my pages on my computer and be able to test them. Is that right? And then PHP that I download is installed on my computer for the same reason: testing. Because it is already "installed" on the internet.
Thanks for any help you can give.
Last edited by dz_boy; 12-30-2005 at 04:08 PM.
Reason: More understanding...
What might be confusing you is what a web server actually is. It is two things... software (apache/php/mysql) and hardware (a computer of some kind). Irrespective of the type of hardware the web server software is normally apache or IIS with php/perl/mysql support. Hardware can be anything from a PDA through to a PC or rack mounted dedicated server. Most dedicated servers (web host) are inferior to a standard PC in processing power but are optimised for handling multiple requests.
You could host your own website. All you would do is install Apache+PHP+MySQL on your own computer and allow other people to access from outside your LAN. But webhosts tend to have the fastest and most reliable service, so I suggest you don't do that. I just thought I'd tell you so you knew that you could use your own computer as a web server.
I never thought about it like that before. It just started as an experiment on a dynamic IP. For a few Euros extra I got a static IP. Now I've got mail, DNS and web servers and 14 domains. Adding extra domains costs nothing and another bonus is no need to ftp anything. I can run whatever server software and config I choose and don't need to worry about the security issues of a shared server. The way I see it is, I pay for a full time connection so I might as well use it.
I've recently started hosting my website off my own box, and find it works fairly well for my purposes. Desperately geeky? Most likely, but it's nice to have everything readily accessible and whatnot...cheaper, too, cause I don't have to pay anyone for hosting, and don't get any of those yucky ad banners that are all over free host sites.
In an attempt to un-derail this thread, though, if you've got any programming experience, you can pick up the basics of PHP real easy over at http://www.w3schools.com/php