Page 1 of 1

PHP not working

PostPosted: 25. September 2006 03:12
by Botamis
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!

PostPosted: 25. September 2006 03:27
by Izzy
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.