PHP not working - Build your own database driven web site using PHP & Mysql

Hi, thanks for your help.

I’ve struck early problems setting up PHP according to the book by Kevin Yank. Firstly I installed (separately as recommended) Apache, MySQL and PHP on my XP PC. Apache looks fine (localhost is OK), so does MySQL. When I run the example ‘today.php’ Windows has a pop up saying ‘Do you want to open or save this file?’ - even though I’ve told Windows to open *.php files with Internet Explorer.

In frustration, I installed WAMP on my other Windows 7 PC - more problems (related?). When I run the ‘today.php’ example it doesn’t return a date from the PHP script (…<?php echo date(‘l, dS Y.’); ?>…), it’s just blank where the date should be. Also, when I run Welcome1.html and click the link ‘Hi, I’m Kevin’ to open Welcome1.php I just get a blank page, even though the address bar says ‘file:///C:/wamp/bin/apache/Apache2.2.21/htdocs/welcome1.php?name=Kevin’.

About 18 months ago I was able to follow the book (on my XP machine) past this early point without any issues (today.php worked OK then) - has Windows blocked something?

Thanks in advance.

Your loading the php file directly in your browser, hence the ‘file://…’

You need to load it through Apache, just type http://localhost in your browser and see if a directory / file listing comes up (this is called the document root). If you don’t see your PHP file in the list, then you must copy the file into that directory, then click on it to load it through Apache, which can load the PHP module to parse the file and get you what you need.

Thanks feketegy, I feared it was something basic. Cheers.