Click to See Complete Forum and Search --> : Plz hlp installing apache 2 & php 5
Starcraftmazter
01-06-2005, 09:58 PM
SuP.
Okey.
I have the latest version of php 5 and apache 2 installed.
I put c:\php5 (where i installed it to) in the window environmental variable path thing.
I put the loadmodule pgp5_module c:/php5/pgp5apache2.dll and addtype application/x-thhpd-php .php .html in the httpd.conf in apache conf folder,
I coped the php.ini-recommended file to the windows folder, and renamed it php.ini
If I try to run a simple php5 script, firefox doesn't know what to run it with, and asks me what to do, same with internet explorer.
I've restarted after all this.
What am I doing wrong? Anyone?
veganboyjosh
01-13-2005, 04:37 PM
i'm having the same problem, i think.
i can load the pages i code, and the html tags are working, but the stuff inside the php tags are not showing up at all. not even the raw code. so it recognizes somethign is there that;'s not text or html, but it doesn;'t know how to read it.
were you able to get it working?
in advance, thanks for your help.
josh
Starcraftmazter
01-13-2005, 05:09 PM
Yes, I now have php, apache and mysql all working alongside one another nicely.
Did you put the php code inside the php tags?
<?php
echo "Testing";
?>
And make sure they are inside the body tags?
Oh, I hope you renamed the document with a .php extension.
veganboyjosh
01-13-2005, 05:13 PM
yeah, i've done both of those.
my feeling is that somethin'gs not right with the httpd.conf file, but i dunno what. i installed and uninstalled apache and php several times last night, and have found several different sources for lines to alter in that file, so i'm not sure it's all been done like it's supposed to.
the php code doesn't show up in the browser window, and the html code behaves like it's supposed to.
at this point i'm looking (i think) for some sample conf files, to compare mine with.
thanks for the speedy reply.
josh
Starcraftmazter
01-13-2005, 05:29 PM
Okey.
Have you coped the php.ini file to c:/windows ??
Have you created a new entry, like c:/php5 (whereever u nstalled php to) in the path: environmental variable.
And have you added these two lines ot httpd.conf
loadmodule pgp5_module c:/php5/php5apache.dll
addtype application/x-httpd-php .php .html
After that you gotta stop and start apache, don't restart it!
veganboyjosh
01-13-2005, 05:31 PM
thanks, i'll try that.
veganboyjosh
01-13-2005, 05:40 PM
ok, i tried that, and it does something different.
when i hit enter after entering the filename int he browser navigation bar, a window pops up and it says the following:
________________________________
you have chosen to open
mytestfile.php
which is a PHP Coder File
from c:\apache2\htdocs
What should firefox do with this file?
open with (firefox.exe)
save to disk
do this automatically with this kind of file from now on.
_______________________________
so when i click on open with firefox, it just opens an empty browser window, and the window pops up again, and this whole thing repeats.
i stopped and started apache, after i made the adjustments to the conf file...
what could i be doing wrong?
thanks again.
josh
Starcraftmazter
01-13-2005, 06:11 PM
Nothing, it's working now.
Open your httpd.conf file and search for <directory
Now, around there you will find something like
DocumentRoot "C:/apache2/htdocs/"
#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
# features.
#
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#
#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "C:/apache2/htdocs/">
Now, replace then C:/apache2/htdocs/ with just C:/ in both those instances.
Now save changes. Stop apache. Start apache.
Now, you cannot open the .php files in a browser like you do with html files.
You must access all your php files like this:
Supose you have file1.php on the C:\ drive, file2.php in c:\webdesign and file3 in c:\webdesign\php\
access the files by launching the browser, and typin the following:
http://localhost/file1.php
http://localhost/webdesign/file1.php
http://localhost/webdesign/php/file1.php
Get the idea?
veganboyjosh
01-13-2005, 06:19 PM
ok, i've one that.
it still opens the window and asks what i want firefox to do with the php coder file.
and when i click "open with firefox.exe", it still just opens a new, empty browser window and asks again.
i know it's close, i can taste it.
josh
Starcraftmazter
01-13-2005, 06:27 PM
Are you sure you did everything I said in my last post?
Remember, don't open the pages in firefox, just type in it's relative localhost address.
veganboyjosh
01-13-2005, 06:34 PM
yeah, i'm not using the "open file" menu, i'm typing the address into the broswer nav bar directuly.
it's close cos when i type the wrong address into the nav bar, it says the file is not found n this server, error 404 i think.
but when i do get the address right, it asks me what i want to do with the file, open it with firefox.exe, or save it to a disk.
when the files are saved as html, they work, but the php coding is skipped over.
when they're saved as php files, the pop up window shows up.
i'm ready to start pulling out my hair now.
josh
veganboyjosh
01-13-2005, 06:38 PM
ok, i read back over your posts, and i had missed something to change in the conf file. i only changed one of the instances of c:/apache2...
and it still did the same thing.
theni realized i had not stopped/started apache. so i did that. same thing with the pop up window.
any ideas?
josh
Starcraftmazter
01-13-2005, 06:52 PM
So....did you change both instances of apache2/htdocs ?????
Have you got the php.ini in windows folder?
And did you really add those 2 lines to the httpd.conf?
If all yes, then I suggest just restarting lol.
It really should be working at this stage, I don't know what's wrong.
Are you apsolutely sure you're refering to your pages through http://localhost/ ???
veganboyjosh
01-13-2005, 07:18 PM
So....did you change both instances of apache2/htdocs ?????
yes, i changed both. and stopped/started apache.
Have you got the php.ini in windows folder?
yes.
And did you really add those 2 lines to the httpd.conf?
yes.
If all yes, then I suggest just restarting lol.
ok, i'll give that a shot.
have you heard of the popup window asking what i want firefox to do with the file? i googled it and found a bunch of outdated security stuff...apparently this "feature" could, at one time, have been used to exploit some hole or something. it's since been fixed, but that doesn;'t help me wheni try toi google it and most of the hits are ages old and not dealing with my problem.
so i think that apache is working ok, in that it recognizes that it's a php file. and firefoox recognizes that it's a php file. but i dunno how to make them open it as a php file.
i'm about done for the day, unless you can think of something else to try.
thanks for your help up to this point,, i really appreciate it.
josh
Starcraftmazter
01-13-2005, 07:29 PM
No probs.
Read my original post, I was having the exact same problem as you.
Until I realised you cant't just open .php files like html files, and have to open the browser first and then type is localhost/filename
Open up apache, and the bottom does it say:
Apache/2.0.52 (Win32) PHP/5.0.3
veganboyjosh
01-13-2005, 07:32 PM
it says apache/2.0.52 (win32)
but no php.
i suspect you're on to something.
i remember the enviornmental variable option, but i forget where it was.
Starcraftmazter
01-13-2005, 09:04 PM
Right then, I know the problem.
Stop apache now.
Go to the httpd.conf file.
Find these two lines (the onces you should hav added).
LoadModule php5_module c:/php5/php5apache2.dll
AddType application/x-httpd-php .php .html
Then copy and delete them.
Go to the start of the .conf file, and do a search for #LoadModule
You should come accross a whole heap of loadmodule lines, some with # in front of them some without.
Go to the last loadmodule line, and right on the next line, paste those two lines
LoadModule php5_module c:/php5/php5apache2.dll
AddType application/x-httpd-php .php .html
Now save.
Start apache.
veganboyjosh
01-14-2005, 03:27 AM
aaaaaaahhhhhhh. you broke it.
that didn't work. it just did the same thing with the pop up window. and the apache server status monitor window thign still just says apache, no mention of php.
and when i just try to go to http://localhost/ , instead of going to the apache test apge (the one that says "this pge means there is apache installed on this system...", it says "you have chosen to open which is a P?HP coder file..." similar to the other pop up window, but there;s no file name on this one. wheni try to load this page, it just does the same thing, opens a new window, with it's own pop up window.
and i remembered to stop and start apache before and after i made the changes.
i also didn;'t know whether the loadmodule and addmodule statements i added to the conf file should have #'s in fron tof them, i tried it both ways, with apache being stopped and started before and after each attempt. to no avail.
Starcraftmazter
01-14-2005, 05:22 AM
Rats I forgot to mention one more thing. I think this is it man.
First of all, these lines
LoadModule php5_module c:/php5/php5apache2.dll
AddType application/x-httpd-php .php .html
SHOULDN'T hvae # in front of them.
second - and most important.
That's taken from my httpd.conf, and I installed my php on c:/php5/
so if you installed it, CHANGE that to whatever it should be!
So if you installed php in c:/php then it should be
LoadModule php5_module c:/php/php5apache2.dll
AddType application/x-httpd-php .php .html
veganboyjosh
01-14-2005, 04:45 PM
ok, the address in this line:
LoadModule php5_module c:/Apache2/php5apache2.dll
is correct. that's where php was installed, and i know it's in there, cos i can see it, and move it in and out of there. (i had a book telling me to install it in the apache2 folder, so it'd all be close by. i think more for my convenience than pragmatism.
somethign abuot these changes has changed apache, so that when i try to go to localhost, the test page no longer comes up, but the pop up window does, saying
_____________________________
you have chosen to open
which is a php coder file
from: http://localhost/
What should firefox do with this file?
*open with |browse...|
*save to disk
*do this automatically for files like this from now on.
_______________________________
so when i click on open, it just tries to open a new browser window, but the pop up window shows up again...
and i have been stopping and starting apache at the correct times thru this.
i was so excited when i got the apache test page to load. now it's gone.
i'm thinking now i'm looking at a complete un/reinstall...woohoo.
Starcraftmazter
01-14-2005, 07:24 PM
Yer, it's not a good idea to install php5 in apache folder.
Install php5 on c:\php5 and apache in c:\ (it will actually install to c:\apache2).
And then redo everything.
PHP Builder
Copyright WebMediaBrands Inc. All Rights Reserved.