Problems configuring Apache - parsing SSI and changing port

I am trying to install & configure Apache on a machine running Windows 7.

  1. After installing, I tried http://localhost/ and got the “It Works!” message.

  2. I then modified the http.conf file so it would parse SSI, namely in shtml and php files.

In doing so, I added these lines:

AddHandler server-parsed .shtml

and

AddType application/x-httpd-php .php
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml

and in the Options directive I added:

Options Indexes FollowSymLinks Includes
  1. I then stopped and started Apache. Upon doing so, I received an error that it “could not bind to address 0.0.0.0:80 no [I]listening sockets”.

[/I]4. I then modified the http.conf file, changing:

ServerName localhost:80
to
ServerName localhost:8080

and

Listen 80
to
Listen 8080
  1. I then stopped and started Apache, and received no error message, and tried opening an shtml file (that is in the htdocs folder- did not change doc root), and it still showed the code itself in the browser window. Now what I thought was strange is that I was able to bring up the file using http://localhost/, and I thought that since I changed the port to 8080 I would have to enter http://localhost:8080/, but if I do that I get a ‘page not found’ error.

So I am confused about that and also don’t know what I’m doing wrong as to why it isn’t parsing the includes.

Thank you in advance for your help.

Mick,

Loading Apache on Win7 (and Vista) is a major PITA! I had REAL problems (despite years of installations on WinDoze boxes) adding it to a Win7/64 notebook.

Keys:

  1. DELETE all vestiges of Apache including the Apache 2 service (services.msc) then reboot (to be sure it’s clean).

  2. Install MySQL as a service. MySQL is no problem.

  3. Install Apache using 127.0.0.0 and localhost as the location and domain. IMHO, install Apache OUTSIDE the Program Files (x86) directory - I used a drive partition I dedicate to my web work: W:\. This it to prevent having to edit the Apache config files (httpd.conf and extras\httpd-vhosts.conf) as the administrator (minor but a PITA to do every time you add a VirtualHost). This is CRITICAL if you store your localhost (or other VirtualHosts) in Apache’s htdocs directory! Finally, on the assumption that you’re smart enough to disable IIS before installing Apache, use port 80 to avoid having to use localhost:8080, virtualhost1:8080, virtualhost2:8080, etc. Make it easy for you to use, not Mr Gates!

  4. Install PHP in the same drive partition as Apache, i.e., OUTSIDE Program Files so that php.ini can be edited, too, without going through the admin routine.

That should resolve not only the problem with your port but with editing the configuration files (which you will have to do more than once) AND localhost (website) files.

Regards,

DK

I followed your instructions below & to avoid the administrator hassles I put it here-- C:\Apache. Let me know if I definitely need to create the drive partition and I will do that.

I got the “It Works” message. Then I edited the http.conf file, same as my original post.

I then tried stopping and starting Apache and again got "could not bind to address 0.0.0.0:80 no listening sockets".I don’t mind using http://localhost:8080/, as it’s not that big of a hassle to me. So, instead of creating a new partition can I just change the http.conf file to listen on Port 8080?

And yes, IIS is disabled, though I had to check first :wink:

Thank you for your help!

Ok, I left it at Port 80 and I have no idea why, but despite the error message about “could not bind to address 0.0.0.0:80 no listening sockets”, everything seems to be working correctly so far. I tried a test .shtml file with SSI and it is being parsed and renders perfectly.

I am now going to install PHP… also in C:\. It is already displaying SSI (in .shtml files) correct, but in order to parse PHP includes, do I just add these lines to the Apache config file?

AddHandler server-parsed .php

AddOutputFilter INCLUDES .php

Thank you!

Mick,

Hmmm, it’s curious that Apache would whine about the IP address then allow you to connect anyway. However, may I suggest that you look into your httpd.conf file for the Listen line which may, in fact, be 0.0.0.0:80 rather than 127.0.0.0:80. If not, I’d consider uninstalling, rebooting then reinstalling to get that IP address correct. It’s apparently not a big deal but …

As for the separate partition, that’s just me. It’s easier for me to backup an entire drive than make the entire C: drive backup just to get the websites backed up. Silly? Like I said, that’s just me (and MY requirements - which aren’t likely to apply to you). The REAL point of my advice above was to avoid WinDoze’s protected directories like the plague! You’ve done so successfully!

Regards,

DK