Page 1 of 1

php page cannot be viewed

Posted: Tue Nov 18, 2003 7:20 pm
by infinite_root
Hi PHP gurus,

I made a big mistake. I installed apache and php for windows and was successful. I can view my php files but not so long....

When I opened my php file on my windows explorer I was asked to open it using programs listed. I choose mozilla to open it and thats it. My mistake had finally come to pass.

Instead of opening my php file in my browser using http://localhost/sample.php

I used programs to open it. Now, whenver i open a php file the codes are being displayed in the browser instead of running it.

How can I rectify my mistake?

I already have this entry on my httpd.conf

AddType application/x-httpd-php .php
AddType application/x-httpd-php .php3
AddType application/x-httpd-php .php4
AddType application/x-httpd-php .shtml
AddType application/x-httpd-php-source .phps

DirectoryIndex index.html index.php index.php4 index.htm default.php index.php3 index.html.var index.shtml

I also, had the following entrered in the http configs.
LoadModule php4_module php4apache2.dll

Pls enlighten me. :idea:

Posted: Tue Nov 18, 2003 10:46 pm
by infolock
are you putting these php files in your htdocs folder in the apache directory?

Posted: Wed Nov 19, 2003 11:19 am
by microthick
I used programs to open it. Now, whenver i open a php file the codes are being displayed in the browser instead of running it.
... open up Windows Explorer. Tools > Folder Options > File Types.

See if .php is here. If so, associate with say your PHP editor and not Mozilla.

No clue if this is your problem, but it's another suggestion.

Posted: Wed Nov 19, 2003 7:42 pm
by infinite_root
infolock wrote:are you putting these php files in your htdocs folder in the apache directory?
Yes, I had my php files located in htdocs where my http.conf directive was pointing. In fact it is opening only viewing its codes and not running it.

I know this is a little too late, Iam using php4 and apache2.4.29 running in my windows 2000 server.

I added the following entries on my httpd.conf

ScriptAlias /php/ "C:/php4/"
Action application/x-httpd-php "c:/php4/php.exe"

LoadModule "php4_module" "C:/Program Files/Apache Group/Apache2/php4apache2.dll"
AddModule mod_php4.c

but still no joy :cry:

Posted: Wed Nov 19, 2003 8:16 pm
by infolock
view this link :

viewtopic.php?t=14722&highlight=

should help.

sounds like you didn't put your LoadModule and AddType's in correctly, as you aren't suposed to even have AddModule in the conf file to start with. the instructions for this provided by php aren't very clear and fail to mention that you have to put the LoadModule and AddType calls in the correct place. The link I gave you pretty much explains this for you .

Posted: Fri Nov 21, 2003 2:29 am
by infinite_root
infolock wrote:view this link :

viewtopic.php?t=14722&highlight=

should help.

sounds like you didn't put your LoadModule and AddType's in correctly, as you aren't suposed to even have AddModule in the conf file to start with. the instructions for this provided by php aren't very clear and fail to mention that you have to put the LoadModule and AddType calls in the correct place. The link I gave you pretty much explains this for you .
I did put all the entries you mentioned in their conrresponding places.
But still doesnt work.

Posted: Fri Nov 21, 2003 2:40 am
by infolock
i think i know what the problem is...

do this :

open up notepad and type in

Code: Select all

<html>
<head><title>bob</title><head>
<body>
<a href="somephpfile.php">Click this</a>
</body>
</html>
where "somephpfile.php" is an actual php script that you have already written.

save the file as bob.htm or something, and then click on the link when you load it in your browser.


edit : the reason for this, is because there is something telling windows to open up PHP extension files with another program, so when you are browsing a list of files from within IE and try to click on a php file, it's asking for an application you want to open it up with instead of just opening up the page.

i had the same problem once upon a time..


if that doesnt work, go to your httpd.conf file, and REMOVE the addmodule statement that you put in it. also, make sure that all your loadmodule calls are ONLY with the OTHER loadmodule calls, and that your AddType calls are ONLY with the OTHER AddType's.

hope that helps.