Frequently Asked Questions: php questions: page: 2
-
1
Is it possible to download an installation file with which I can install PHP locally on my computer? I want to learn PHP, and I want to be able to look at the files without having to upload them to my webspace.
Actually, yes, that is possible, but it’s not for beginners! You’ll need to run a webserver - if you have a Linux host, apache.org is probably the best call. They have instructions on how to set it up, download it, configure it, etc.
Then go to php.net and download the latest PHP binaries for Windows. Install it, and follow the directions to configure it.
After you have a webserver installed, there will be a folder on your computer called the “web root”. You put your files in there (and its subdirectories) and if you type http://localhost/ or http://127.0.0.1 into your browser, you will be able to see your website (which consists the files in that directory). And anything with a .php extension will be executed as a PHP script.
Tips:
-
This website has step-by-step instructions on how to install Apache and PHP in a Windows environment. It is very helpful.
-
When configuring Apache it asks for a domain/server name. You should enter “localhost” (without the “”).
-
There are a few “packages” you can download which already come with apache, php, MySQL and a few more things. One of them is XAMPP, it’s very easy to install and you’ll have PHP on your computer within minutes.
-
-
2
When a try to view anything.html, which has PHP code in it, it either doesn’t show up, or it will show me the code. Why?
PHP won’t execute any coding unless the extension of the page is .php. So no PHP code will work on .html pages - that’s why. Change your extension to .php and it will work.
-
3
What books would you recommend to help learn PHP?
I (Sasha) personally found the following books very very helpful:
Amazon.co.uk:
Amazon.com
-
4
What is my absolute path?
What your absolute path is depends on your server. On most cPanel servers, your absolute path will look something like this:
/home/username/public_html/
where you replace “username” with the username you use to login to cPanel. On some cPanel servers, you can see what your absolute path is when you login to cPanel, in a sidebar or Stats section.
On servers with other control panels this can be slightly different. If you’re not sure what your absolute path is, check the FAQ at your host’s website. Chances are it’s detailed there. If you can’t find it there, send your host an email and ask them about it, they’ll be able to tell you what your absolute path is.
-
5
How can a have one of those check lists where the person can select one answer only (radio buttons)?
Radio buttons allow the user to choose only one of a number of options. When you choose one option, any previously selected option is unselected. Radio buttons are grouped together by assigning them all the same NAME (but different VALUES).
<p>Which one of these old TV Shows do you miss the most? <br /><input type="radio" name="oldtv" value="madaboutyou" />Mad About You <br /><input type="radio" name="oldtv" value="fullhouse" />Full House <br /><input type="radio" name="oldtv" value="stepbystep" />Step by Step <br /><input type="radio" name="oldtv" value="partyof5" />Party of Five <br /><input type="radio" name="oldtv" value="dawsonscreek" />Dawson's Creek <br /><input type="radio" name="oldtv" value="buffy" />Buffy, the Vampire Slayer</p>
Like checkboxes, you can define a radio button to be checked by default, but unlike checkboxes you should only have one radio button in a group initially checked.
<p>Which one of these old TV Shows do you miss the most? <br /><input type="radio" name="oldtv" value="madaboutyou" checked="checked" />Mad About You <br /><input type="radio" name="oldtv" value="fullhouse" />Full House <br /><input type="radio" name="oldtv" value="stepbystep" />Step by Step <br /><input type="radio" name="oldtv" value="partyof5" />Party of Five <br /><input type="radio" name="oldtv" value="dawsonscreek" />Dawson's Creek <br /><input type="radio" name="oldtv" value="buffy" />Buffy, the Vampire Slayer</p>
Now you have Mad About You checked and set as default.
Remember: all the radio buttons in a group must have identical names (like in the example above - the name is set to "oldtv" for each option).
May 21, 2004 |
By Louise |
Filed under FAQ, NL-PHPMail, PHP, Scripts