简体   繁体   中英

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.

确保您通过http://localhost/file.html而不是c:\\etc etc.html访问html文件

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/

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 .

在XAMPP控制面板中,确保Apache已启动。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM