user1364686
user1364686

Reputation: 63

Running PHP on my machine locally?

I download xampp 1.7.7 and it has PHP and MySQL. I bought a book named HeadFirst PHP MySQL. My problem is that I can't run the examples from the book.

The example files consist of 2 files: one HTML, and one PHP file. The example is like this you fill the form from HTML file then send it to a web server then the php will handle the HTML file then return it to you.

When I filled the form then I click the submit button, it didn't return what it was supposed to return. What it returns is the actual PHP code.

Do I need to transfer all the files from the book to a webhost so that I cant try the examples I said? How can I run it locally?

UPDATE!!
I tried what anselm said now it says OBJECT not found... url not found then the 404 error.

Upvotes: 0

Views: 3707

Answers (4)

anselm
anselm

Reputation: 13651

Ensure that you're accessing the html file through http://localhost/file.html instead of c:\etc etc.html

Upvotes: 5

COLD TOLD
COLD TOLD

Reputation: 13569

if you are developing on windows i really recommend using wamp it really easy to use and include the main stuck which is php, mysql, apache it really easy to install and automatically configures everything you then can find www folder in wamp folder on your c drive where you have to drop you php files

http://www.wampserver.com/en/

Upvotes: 3

Aventuris
Aventuris

Reputation: 630

In your XAMPP Control Panel, make sure that Apache started.

Upvotes: -2

Brad
Brad

Reputation: 163272

Your PHP code isn't being parsed by PHP. Either the Apache config is wrong (unlikely since you installed XAMPP, but you can check by following the steps at http://www.php.net/manual/en/install.windows.apache2.php), or your files aren't really named .php.

In Windows, make sure you have file extension viewing turned on, and ensure the file extensions really are .php.

Upvotes: 2

Related Questions