PHP not working

Problems with the Windows version of XAMPP, questions, comments, and anything related.

PHP not working

Postby Botamis » 25. September 2006 03:12

Or maybe I'm a noob. Either way I can't seem to get it to work. Anyway I just started trying to use PHP. Bought me a book and away I go.

I put my files in xampp\htdocs. I then tried to test them out with firefox and they wouldn't come out correctly.

Something as simple as this would not even show up, the page was blank:
<?php
echo "Hello world";
?>


I copied this straight from the book:
<?
echo "Order processed at ";
echo "date("H:i, jS F")";
echo "<br>";
echo "<p>Your order is as follows:<br>";
echo $tireqty." tires"<br>;
echo $oilqty." bottles of oil"<br>;
echo $sparkqty." spark plugs"<br>;
?>


This is what came up on firefox:
"; echo "

Your order is as follows:
"; echo $tireqty." tires"
; echo $oilqty." bottles of oil"
; echo $sparkqty." spark plugs"
; ?>


Please help me and thanks a bunch!
Botamis
 
Posts: 1
Joined: 25. September 2006 03:05

Postby Izzy » 25. September 2006 03:27

php is working if you can access http://localhost and get to the XAMPP Welcome Pages.
All the pages are mixed php and html which require the file extension of php for the server to parse the php components.

Try saving the file with a php extension instead of an html or htm extension:
http://localhost/myfile.php

General rule:
All html - use the .html or .htm extension.
All php - use the .php extension.
Mixed php and html - use the .php extension.
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 127 guests