Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

apache - Localhost/phpmyadmin/ returns php code

But however after changing the "httpd.conf" directory from index.html -> index.php I got this:

http://i.imgur.com/L291njR.png

Then I tried using XAMPP and even after that I've gotten that screen. Could someone tell me what I might be doing wrong?

Computer OS: Windows XP

Full Screen dump: http://pastebin.com/Zbbxvxib

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Your problem is (as suggested in the comments) Apache has no idea "how" to run php, so it is just giving you the raw php files. You need to install PHP if you haven't, otherwise, if you have installed php you need to configure apache to use it.

If PHP is NOT installed

Go ahead and google it, there are a ton of resources out there explaining how to do it.

A good thing to look for is the WAMP stack. Which stands for Windows, Apache, MySQL & PHP. There are many places showing you how to install each of these individual components.

If PHP is installed

The httpd.conf file needs to be modified to include PHP.

Add the following line after all of the LoadModule statements:

LoadModule php5_module "[PathToPHP]/php5apache2_2.dll" 

Search for AddType, and add the following after the last AddType line:

AddType application/x-httpd-php .php 

Add the PHP location to the end of the httpd.conf file. For example, at the end of the file, add the following:

PHPIniDir "[PathToPHP]"

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...