Help - Search - Members - Calendar
Full Version: Installing PHP with Apache 2.2 under Windows
HTMLHelp Forums > Programming > Web Server Configuration
Dr Z
I have Apache 2.2 running under Windows in my new (well, relatively) laptop. Now, I am in the process of installing PHP 5, as an Apache module. for same reason: Off-line testing.
  • I have installed all relevant files in a sub-directory name PHP5 in the root directory (C:).
  • I copied all the pertinent PHP .dll files to the root directory of Apache 2.2, including the file 'php5apache2.dll'
  • I renamed 'php.ini-recommended' to 'php.in'i, and, in this file, I set the 'doc_root = C:\Program Files\Apache Software Foundation/Apache2.2/htdocs'
When I un-comment the line "LoadModule php_5module php5apache2.dll" in 'httpd.conf file', I get an error message saying that the file 'php5apache2.dll' can not be found.

The most puzzling part is this:
I had installed Apache 2, PHP 5, MySQL, and even Pearl, in my PC about 2+ years ago (with some help from the old timers of this board, at times) and tested them. Now I am looking at both computers side by side and comparing the files in each directory. config files, etc.), and I cannot find a difference. I even run a "configuration test" of the Apache 'httpd.conf file' in my PC, as a sanity check, and did not encounter any error messages.
The only difference is my PC has Apache 2 installed and the laptop has Apache 2.2.

I would appreciate any comments and/or pointers as to what I am doing wrong.....
Effovex
Last I tried installing PHP on Windows the install instructions were full of mistakes. I had similar problems the time before that as well, and those two attemps were separated by one or two years, so I'm guessing they don't care much about Windows users.

Googling gave me a site which has very detailed instructions on installing PHP5 and Apache2 on Windows, hopefully it'll help.
John Pozadzides
Effovex,

Thanks for finding that site. I just spend a couple of hours going through it, and I'm now running Apache and MySQL on my PC. :-)

Now I'll actually be able to test things at home before loading them to the live environment.

John
JamieHarrop
I've been using PHP Dev for a number of years for my offline testing. It comes complete with Apache, PHP and MySQL, and it installs it all for you. smile.gif
Dr Z
QUOTE(Effovex @ Mar 8 2007, 09:36 PM) *

Googling gave me a site which has very detailed instructions on installing PHP5 and Apache2 on Windows, hopefully it'll help.


I spent my Sunday chasing my tail. First I tried the method suggested by this site... No luck!

Then I found this site. A completely different approach, but it made sense. I followed their instructions, with the exception that I am using php5apache2_2.dll included in the zip file for PHP 5.2. Net result is same. When I call up the test fille (test.php), I get 404 - page not found. I appears that the .php extension not recognized?

Any suggestions or quesses as to where the goof my lie?
Dr Z
I found the cause! If anybody is using, or intend to use vhosts, the following story may be of interest:

I started with the question "Why 404?", and did some nosing around and found the cause. I was barking at the wrong tree! The cause is not PHP, but it is actually due to Apache and vhosts.

Let me explain:
I use vhosts for each site and do not use the main htdocs directory of Apache.
I had put the test.php file in the main htdocs directory, and was trying to call it up by httpd://localhost/test.php, Then getting the "404 Not Found" message.

But now comes the surprise:
I made sure that there was no index file in the main htdocs directory, and called up httpd://localhost.
Instead of getting the directory listing, I got the index page of the first registered vhost (in the order the vhosts were entered in to the httpd.conf file.)

I moved the test.php file to one of the vhosts, and everything is fine.

Solved one problem, uncovered another! And, I have no explanation to offer......
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2024 Invision Power Services, Inc.