Page 1 of 2

PHP Newbie: Win2k, Apache, PHP

Posted: Wed Sep 25, 2002 7:47 pm
by infolock
Ok people, it's now again time for the newbie question of the day. First of all, let me reassure you, I have indeed read the manual ( I printed all 1800+ pages of it off and binded it in 2 binders lol ), and have thoroughly inspected the Install.txt file included with php 4.2.3.

Here is the breakdown:

-----------------------------------------

Using:
Windows 2000 Advanced Server
PHP 4.2.3
Apache HTTP 1.3.26


-----------------------------------------


Now, what I did was ( and yes, this is all from memory, as I'm not at home and only at work ), I reformatted my pc and installed windows 2000 advanced server. Then, I installed Apache 1.3.26 ( I did not download v2.0 as everytime I tried to find the download, I could only find the "compile me" version, whcih I did not want to waste the time to do.. ).

After installing these, I then downloaded PHP 4.2.3, and extracted it to my C:\PHP. The readme file says that I need to set paths in the php.ini-dist, and so I did. I set the paths that it asked for, renamed php.ini-dist to php.ini, and copied the php.ini to my C:\winnt\ directory. I then copied all my DLL's in c:\php\dlls\ directly to my c:\winnt\system32\ directory.

After doing this, I read on. It says that I then should just use PHP as a module for Apache, which I assume is correct. So, I added the 3 lines of code into Apache Configuration ( yes, I stopped the server before doing this ).

After just pasting the 3 lines into the file at the first given spot ( since it does not even start to explain where in the hell you are to dump these 3 lines at ), I started Apache up, and it gave me a message saying something like "Module PHP has already been started... Skipping".

So, I re-read the Apache Config Page, and found that I should put the LoadModule statement with the other LoadModule Statements, and the AddModule Statements on down the page with the others.

Upon doing this, I no longer got this message when Apache started up, and instead just got "Server Starting".

"GREAT!" I thought to myself, "it's Finally gonna work!".

So, I rushed on over to my c:\inetpub\wwwroot\ directory, and I created a page with the following code:

-------------------------------------------------------

Code: Select all

<html>
<head><title>Example 101</title></head>
<body>

<?php 
echo "HELLO!!!!!!!!!!!!!!!";
?>

</body>
</html>
-------------------------------------------------------


But alas, it was only a false insight... When I load this page, it will display the title "Example 101" at the top of the page, but the entire page is blank, showing nothing as an output. In other words, I did not get Hello!!!!!!!!! posted nicely on the page...

This discouraged me. So, I copied the index.php page that I created to every-single-directory on my c:\. And when I say every single page, I mean just that. I went through every directory on my winnt directory ( including the root ), InetPub Directory, program files, desktop, Apache Group\Apache Directory, and exhausted myself just KNOWING that it was I was putting it in the incorrect directory... But I wasn't.

So, I follow the steps again from the Insall.txt file, making sure I did step by step what it said. Still, same result.

So, I figure "must be a problem with win2k", so, I say "hell with it", and nuke the machine, re-install win2k, apache, and commence to re-installing php, and damnit if it didn't have the same result.

At this point, I was getting frustrated. So, instead of just using the php.ini-dist file like the install.txt and the php manual says, I instead did what it also recommended, and used the php.ini-recommended file. I followed the same steps as before, copied it to the directory, prayed, and got slapped in the face one more time.

I then started looking at the extensions, thinking it was something to do with that in the PHP.INI file. So, I uncomment every-single extension ( except for the mysql and odbc as it is not needed ), thinking this was the issue. Rebooted win2k, re-started apache ( just in case! ), tried, held my breath, and nothing...

So, I checked to make sure the LoadModule string was pointing to the correct directory, and it was...

I then made sure also that I did put the php4apache.dll in the apache directory ( all directories actually, even system32 ), but did not help.

There was also a php4 file ( can't remember the exact name ), but it was also a dll, that wanted you to put it in the root of winnt, maybe it was system32, can't remember, but, yes, I did that as well LOL.


.... Basically, i'm getting the same problem. Blank page. If someone could help me out here, tell me where I'm screwing up, or tell me what I need to try differently, that would be great...

Sorry for the long write up, but wanted to ensure everyone that I am following the instructions, just something isn't working right....

Please help me!... *begs on hands and knees*

Thanks 8O

Posted: Wed Sep 25, 2002 9:14 pm
by volka
win32 binary packages can be downloaded from http://www.apache.org/dist/httpd/binaries/win32/ either apache 1.3 or apache 2.0
---
open a command-line-window, change to your php directory (probably: cd C:\php ) and enter
echo "<?php echo phpversion(); ?>" | php-cli
does this return the version or an error?
---
in your httpd.conf search for the line
LoadModule info_module modules/mod_info.so
if commented remove the leading #
same with AddModule mod_info.c
uncomment the whole
<Location /server-info>
</Location>

block and change the allow from ... to allow from 127.0.0.1
restart your apache server and open the page http://127.0.0.1/server-info
search for the php-module listed on this page. Is it there?
---
still on /server-info search for mod_mime.c
In the same section do you find
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
and does this match the 'content handler's-value in the mod_php4.c-section?
---
always take a look into <apache dir>/logs/error.log and the eventlog of w2k/XP

Posted: Thu Sep 26, 2002 12:45 am
by Takuma
How come you're using Windows 2000 Advanced Server AND Apache?

Code: Select all

LoadModule php4_module c:/php/sapi/php4apache.dll
   AddModule mod_php4.c
   AddType application/x-httpd-php .php
Code to add to httpd.conf and have you copied php.ini to %SYSTEMROOT% directory? If there aren't any luck how about using CGI binary?

Posted: Thu Sep 26, 2002 5:01 am
by twigletmac
Just to check ('cause you never said it), you are going to http://localhost/index.php aren't you? Not just trying to open the page directly from it's folder?

Mac

Posted: Thu Sep 26, 2002 7:30 am
by volka
uh, I always forget the simplest reason 8O

Posted: Thu Sep 26, 2002 11:13 am
by infolock
Heh, thanks for all the replys. For the answer to the mod, yes, I was just double-clicking the php file in the directory instead of actually typing the address... I think that is possibly the answer here, as unfortunately, the manual never made it clear one way or the other how to open up the page successfully lol....

I'll try that when I get home =)

As far as the question to why I'm using win2k advnced server AND apache, the answer is simple. PHP can either be a cgi-driven module, or an integrated module. I chose to use the isapi instead of the cgi with IIS.

V: If what the mod suggested does not work, I'll follow your steps.

THanks so much to everyone that replied!!! I appreciate all the help!

Now i'm ready to get started!!

The anticipation of having to wait til school/work is over to fool around with it at home is killing me though :( hehehe
8)

Posted: Thu Sep 26, 2002 2:56 pm
by twigletmac
Just so's you know, c:/inetpub/wwwroot is where IIS keeps its web root, IIRC Apache has its somewhere else so you should check on that.

Mac

Posted: Thu Sep 26, 2002 3:37 pm
by infolock
Ok, so I went home after school, and tried going to http://localhost/index.php. when I type this in as the address, I get a message that says "Connect/Stay Offline". Of course, I work offline, but when I do, it says that the address cannot be found.

So, I try typing in ftp://localhost , but it then says that the network is offline. Am I still screwing up somewhere?

But, here is the even wierder part...

When I go into dos, and I try the command

------------------------
php -a index.php
------------------------

it works fine as it should. in other words, it will display the following output:

Code: Select all

<html>
<head><title>Example 101</title></head>
<body>
Hello!!!!!!!!!!!!!</body>
</html>
So, in other words, it shows that php is working properly when done via the php app manually.


Is this a problem with my win2k setup then?

Because I both installed and removed Win2k Web Server Component, but still the same issue comes up....

Do I actually have to setup DHCP, or DNS, or something to that nature?

Again, thanks for all the help/commends 8O

Posted: Thu Sep 26, 2002 4:14 pm
by Takuma
How about making it online?

Posted: Thu Sep 26, 2002 4:37 pm
by infolock
unfortunately, I don't have the internet at home =\

When I say I download stuff, I mean I download it from mom's house, burn it to a cd, and then run it back to my place =P

Posted: Thu Sep 26, 2002 4:38 pm
by Takuma
Try doing it "Connect", what happens?

Posted: Thu Sep 26, 2002 4:42 pm
by infolock
pops up asking me how I am wanting to connect ( dialup or network )


EDIT: In other words, connection wizard pops up...

Posted: Thu Sep 26, 2002 4:52 pm
by jason
Are you sure apache is running when you try to connect to http://localhost/ ?

Posted: Thu Sep 26, 2002 4:54 pm
by infolock
Yes, I restarted it twice actually lol...

Says "Apache server is now starting" or something to that effect...

It's killing me lol...

Do I need to setup something on the win2k side or something? Kinda thought that I wouldn't have to since apache is installed...

I checked the server name, and have it set to 127.0.0.1

Tried using localhost as well, and also the actual server name, but didn't help...

Posted: Thu Sep 26, 2002 4:56 pm
by jason
Well, I am running on the assumption right now that the problem lies in Using IE. IE isn't connected to the web, and it knows it. Hrm....maybe check and see if google has any information on your problem?