system32 Posted March 12, 2010 Share Posted March 12, 2010 I am new to this. I downloaded PHP and Apache and installed it to: C:\webserver\Apache2.2 C:\webserver\PHP I also created a folder called webroot in the webserver folder. I then went into the httpd.conf file and edited the following: DocumentRoot "C:/webserver/webroot" <Directory "C:/webserver/webroot"> DirectoryIndex index.html index.php Also added this to the end of the file: LoadModule php5_module "C:/webserver/PHP/php5apache2_2.dll" PHPIniDir "C:/webserver/PHP" AddType application/x-httpd-php .php In my webroot folder I made a file called index.php with the code: <?php phpinfo(); ?> In my enviornment varibales I have this: Path: C:\webserver\PHP\;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\ PHPRC: C:\webserver\PHP\ I type in localhost in the browser URL and nothing shows up, says it cant find it. I try to run apache but it says that the requested operation has failed! I checked the log file and it says: httpd.exe: Could not reliably determine the server's fully qualified domain name, using xxx.xxx.x.xxx for ServerName [Thu Mar 11 19:30:08 2010] [warn] pid file C:/webserver/Apache2.2/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run? What am I doing wrong? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/194965-problem-installing-php/ Share on other sites More sharing options...
system32 Posted March 12, 2010 Author Share Posted March 12, 2010 I decided to install XAMPP. I installed XAMPP and put my files into the default htdocs folder. The PHP files work and I can see the phpinfo() file run fine, but I am writing .html files which will send data to PHP to validate the data and return a response. This is my code which at school worked fine: PHP FILE: <?php $number1 = $_POST["number1"]; $number2 = $_POST["number2"]; $average = ($number1 + $number2)/2; if($average>89) { print ("Average score: $average You got an A!<br>"; } $max = $number1; if($number1 < $number2) { $max = $number2; } print ("Your max score was $max"); ?> HTML FILE: <html> <head> <script language="javascript"> function checkNumber() { if(document.form1.number1.value == "") { alert ("Please enter a number 1"); } else if (document.form1.number2.value == 0) { alert("Please enter a second number"); } } </script> <title>Excersise 10</title> </head> <body> <form name="form1" method="post" action="" onSubmit="return checkNumber()" action="excercise10.php"> <p> <label> Enter a number: <input type="text" name="number1" id="number1"> </label> </p> <p>Enter a second number: <label> <input type="text" name="number2" id="number2"> </label> </p> <p> <label> <input type="submit" name="submit" id="submit" value="Submit"> </label> </p> </form> </body> </html> Nothing happens at my house when I click submit. It just erases everything, but at my school it would output the PHP file. Why is this? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/194965-problem-installing-php/#findComment-1025022 Share on other sites More sharing options...
wildteen88 Posted March 12, 2010 Share Posted March 12, 2010 When you're running the html file make sure you're going to http://localhost/ first. Quote Link to comment https://forums.phpfreaks.com/topic/194965-problem-installing-php/#findComment-1025293 Share on other sites More sharing options...
system32 Posted March 13, 2010 Author Share Posted March 13, 2010 got it working, Thanks Quote Link to comment https://forums.phpfreaks.com/topic/194965-problem-installing-php/#findComment-1025700 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.