Total noob who needs a lot of help installing PHP and server
Moderator: General Moderators
-
asfastasdark
- Forum Newbie
- Posts: 1
- Joined: Wed Aug 26, 2009 9:30 pm
Total noob who needs a lot of help installing PHP and server
OK, I don't know a ton about computers but I've been coding XHTML and CSS, and a derivative of C++ for a while now, and I thought I'd try PHP. OK, I've tried installing PHP and Apache, made a test file with a simple echo statement in it and got about 10 errors about files not found. So I'm assuming I did something wrong.
Could someone guide me through the process of what all I'd have to do to get PHP files working on my computer? Do I even need an HTTP server? I'm using Microsoft Windows XP. Thanks so much to anyone who could get me to get this working.
Edit: For clarification of how little I know as far as computer jargon goes (though I'm not a total idiot either), I don't even know what a binary is. 
Re: Total noob who needs a lot of help installing PHP and server
Yes, you need a web server, because PHP is interpreted by the web server. Unlike other languages that are either compiled (like your C++ or similar) or interpreted in a browser, like Javascript, PHP is only interpreted by a web server like Apache or Microsoft IIS, but both of these need to be configured with appropriate .dll's (in the case of Windows). You said you have installed Apache. #1, is it running? You can check on this in Windows by opening your Start menu, clicking on Run and entering "services.msc". You should see a list of services, showing which ones have been started (most at startup). If you can't find Apache at all (probably Apache2.2), then it's not properly installed. If it's listed, but doesn't show "started", you can doubleclick on it and either start it or set it up to be started automatically at boot time.
If Apache is running, you should be able to display simple HTML/CSS/Javascript files by opening a browser and entering "localhost/xxxxxxxxx.html", where that file exists in Apache's "Document Root" folder, which is specified in the configuration file httpd.config. Most installations default to something like C:\Program Files\Apache\htdocs or something like that, but it might be different, depending on how you installed Apache and whether you have customized your httpd.config file.
Now, if all that is working, the further issue is whether httpd.config has a couple of key lines in it to permit it to work with PHP. Again, the details depend on how you installed all this, but mine, for example contains these 2 lines, one of which tells Apache where the PHP dynamic link library file (.dll) is located, and the other where the PHP.ini file is located:As you can see, httpd.config is a key file, and it will help for you to become familiar with it, although use care when editing it. Always save a backup copy before making any changes. It is usually found in a "config" folder inside the folder where you installed Apache (probably in Program Files).
FYI, "binary" just means "based on two". Internally, computers deal in binary values that are represented as "1"s and "0"s. So we think of a number like 35, but inside the computer, the chips can't recognize a number like that, nor letters of the alphabet. Everything gets converted into "bytes" and larger groups of "1"s and "0"s. So an 8-bit byte that represents what you and I know as 35 would be (in binary): 00100011 because each binary position represents a power of 2, starting with the 7th power of 2 (128) at the left, then the 6th power (64), then the 5th (32), then the 4th (16), the third (8), the second (4), the first (2), and finally the zero power of 2 (1). That's commonly written with a space in the middle to make it easier to read: 0010 0011. The highest value that can be represented with one byte is 255 (1111 1111), so for larger numbers you have to use more than one byte. That's what computers work with, internally--100%. So a "binary file" is just a file that contains just binary values, thus isn't readable by humans, only by computers (or REALLY geeky humans).
If Apache is running, you should be able to display simple HTML/CSS/Javascript files by opening a browser and entering "localhost/xxxxxxxxx.html", where that file exists in Apache's "Document Root" folder, which is specified in the configuration file httpd.config. Most installations default to something like C:\Program Files\Apache\htdocs or something like that, but it might be different, depending on how you installed Apache and whether you have customized your httpd.config file.
Now, if all that is working, the further issue is whether httpd.config has a couple of key lines in it to permit it to work with PHP. Again, the details depend on how you installed all this, but mine, for example contains these 2 lines, one of which tells Apache where the PHP dynamic link library file (.dll) is located, and the other where the PHP.ini file is located:
Code: Select all
LoadModule php5_module "C:/Program Files/PHP/php5apache2_2.dll"
PHPIniDir "C:/Program Files/PHP/"FYI, "binary" just means "based on two". Internally, computers deal in binary values that are represented as "1"s and "0"s. So we think of a number like 35, but inside the computer, the chips can't recognize a number like that, nor letters of the alphabet. Everything gets converted into "bytes" and larger groups of "1"s and "0"s. So an 8-bit byte that represents what you and I know as 35 would be (in binary): 00100011 because each binary position represents a power of 2, starting with the 7th power of 2 (128) at the left, then the 6th power (64), then the 5th (32), then the 4th (16), the third (8), the second (4), the first (2), and finally the zero power of 2 (1). That's commonly written with a space in the middle to make it easier to read: 0010 0011. The highest value that can be represented with one byte is 255 (1111 1111), so for larger numbers you have to use more than one byte. That's what computers work with, internally--100%. So a "binary file" is just a file that contains just binary values, thus isn't readable by humans, only by computers (or REALLY geeky humans).