[Solved] I'm lost without PHP!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

[Solved] I'm lost without PHP!

Post by Gen-ik »

Solved

After searching the net for an hour I found the answer to the following problem. For some odd reason I had to manually add the PHP mime-type into the conf/mime.types Apache file!!! You would have though they would have added it already!

Anyway.. here's the mime-type for PHP just in case anyone else has the same problem.

application/x-httpd-php

**********************************************************
I picked up a brand-spanking-new PC this weekend and it's all working fine (which is nice) but I can not for the life of me get PHP running with Apache again!! It worked fine on my last system and I don't know what I'm doing wrong... I running Apache on Windows XP by the way.

I've set-up the Apache httpd config file to load up the relevant PHP related files and it loads up fine with no errors so I'm guessing everything is ok with Apache. However, when I try to run a PHP file I get the PHP code being displayed and not executed.

I've set-up Apache to open index.php files in exactly the same way as I did on my last system.

PLEASE HELP! I LOST WITHOUT PHP!!! :cry:
Last edited by Gen-ik on Thu Apr 15, 2004 2:59 am, edited 1 time in total.
d3ad1ysp0rk
Forum Donator
Posts: 1661
Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA

Post by d3ad1ysp0rk »

Make sure you set your directoryindex to the folder you'd like to use.
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

Post by Gen-ik »

Yeah that's the strange thing.. I've gone through the conf file several times to make sure all of the paths etc are correct (just done it again) and there's still no joy unfortunatly.

I'm confused.
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

Post by Gen-ik »

I've just tried a bog-standard HTML page and that's also being displayed as text and not HTML... so it's not just a PHP thing.

I can view the htdocs folder fine by going to http://127.0.0.1/ so Apache is working in that respect.
d3ad1ysp0rk
Forum Donator
Posts: 1661
Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA

Post by d3ad1ysp0rk »

Try rebooting? (computer and/or apache).
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

Post by Gen-ik »

Yep, tried that as well.. still not working.
d3ad1ysp0rk
Forum Donator
Posts: 1661
Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA

Post by d3ad1ysp0rk »

So what do you get when you load 127.0.0.1?
Index of/?

If so, what happens when you click on .txt files?
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

Post by Gen-ik »

I made a little test page with a bit of HTML and a bit of PHP chucked into it and the following is what gets display...

<b>Hello</b><br />
<?php echo "BOB" ?>
<? echo "BOB" ?>

...and that's from http://127.0.0.1/index.php

If I try creating a simple HTML page I get this...

<b>Hello</b>

...from http://127.0.0.1/index.html

Apache for some reason isn't executing the files as HTML and/or PHP but is displaying the 'source code'. It seems to be treating them as plain/text files for some reason.
Post Reply