|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
#1 |
|
Member (5 bit)
Join Date: Jan 2007
Posts: 18
|
Apache 2.2.9 & PHP 5.2.6 - New Install
I'm on a mission to learn PHP! So...
I recently installed Apache 2.2.9 & PHP 5.2.6 on my XP machine which also has IIS installed and running. The Apache server is listening to port 8080 and IIS is listening to port 80. After the installs I did the suggested tests to ensure that both products run. IE: I got the “It Works!” message in Apache and then I executed info.php from localhost:8080 and got the PHP stats. Next, (using samples from a book) I created a php folder within the htdocs directory. IE: c:/Program Files/Apache Software Foundation/Apache2.2./htdocs/php Next, I created a helloworld.php script in the php directory created above. IE: (without the comment ‘#’s) # # # $myvar = "Hello World, $firstname"; # # echo $myvar; # #?> Next, I created an html program also in htdocs to run the script. (I removed the tags so it would print) IE: HTML BODY FORM ACTION="helloworld.php" METHOD=post First Name INPUT TYPE=TEXT NAME="firstname" SIZE=30 INPUT TYPE=SUBMIT NAME="SUBMIT" VALUE="Submit" /FORM /BODY /HTML Next, I executed helloworld.html from localhost:8080 and entered my name in the input field of the form. Then, I hit the submit button and I get the following error message: Notice: Undefined variable: firstname in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\php\helloworld.php on line 3Hello World, So, my question is: Why is the variable firstname not being resolved? Note: I haven't changed httpd.conf beyond the instructions to install Apache. I'm speculating that an include in httpd.conf needs to be uncommented, but I don't know which one(s). Any help would be greatly appreciated! Thanks, Heed Last edited by heedapeeker; 09-21-2008 at 08:33 AM. |
|
|
|
|
|
#2 | |
|
Barefoot on the Moon!
Staff
Premium Member
Join Date: Aug 2002
Location: Northeastern USA
Posts: 13,385
|
First, use the CODE brackets for pasting code directly here on the forums (it's the # symbol in the wysiwyg editor). That'll allow you to post your code in an unaltered format
Quote:
if you said something like Code:
$firstname = "Bob"; $myvar = "Hello World, $firstname"; echo $myvar; Two notes on the side here 1) Do you have any other prior programming experience? I just want to see if I can connect that up with what you're trying to do currently so it can make more sense 2) Beginning PHP and MySQL 5 by W. Jason Gilmore has got to be one of the best resources I've seen on starting to program in PHP (ISBN 1-59059-552-1). Note that I did skip the chapters on how to set up a LAMP/WAMP webserver, so I can't vouch for that part of the book, but everything else is very well done.
__________________
There are two secrets to staying young, being happy, and achieving success. You have to laugh and find humor every day, and you have to have a dream.
|
|
|
|
|
|
|
#3 |
|
Member (5 bit)
Join Date: Jan 2007
Posts: 18
|
Hi Force, thanks for the reply
![]() I have well over 20 years of software development experience, mainly in the area of back office financial systems. Unfortunately, my experience is about 95% mainframe related: using COBOL, CICS, PL1, RPG, etc. In Y2K I got out of the mainstream work force because, as you know, the world seemingly switched to networked systems overnight, which was no big surprise given the doomsday scenarios that certain governments were proclaiming for years (nuff said about that). My objective regarding PHP is to build customized forum/message board software to support a project I’m working on and I don’t want canned or costly software. PHP is only the first step, I’ll also be seriously looking at some high level languages like PERL, but I want to get PHP down first. As for the example I mentioned, hardwiring $firstname to = “Bob” won’t do the trick because the input has to come from the browser. Thanks for the heads-up on that book! Regards, Heed |
|
|
|
|
|
#4 |
|
Barefoot on the Moon!
Staff
Premium Member
Join Date: Aug 2002
Location: Northeastern USA
Posts: 13,385
|
SMF and phpBB are two examples of free forum software you can use. No need to make your own unless it's for fun/practice.
|
|
|
|
|
|
#5 |
|
Member (11 bit)
Join Date: Jul 2006
Location: England - UK
Posts: 1,227
|
This is something that came to learn just a little too late. After spending weeks putting together a fairly decent custom built message board I then realised just how easy it was to install phpBB, which offers far more customisation than my creation and costs nothing to get up and running.
__________________
** Custom Desktop: Core i3-530, 4GB Corsair RAM, 500GB WD HDD ** ** Netbook: HP Mini 210, N450, 2GB RAM** |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|