Solved

Which php.exe and Apache httpd.conf being used on W7?

Posted on 2015-02-17
35
115 Views
Last Modified: 2015-03-03
I have multiple Apache/PHP installs on my PC.

How can I figure out which php.exe and Apache httpd.conf are currently being used on my W7 pc?

I can tell which Apache version is running by looking in Service, Properties for the started Apache service (General tab, Path to executable: "C:\Apache\bin\httpd.exe" -k runservice); but that doesn't tell me which httpd.conf the service is using

I figure the httpd.conf will tell me which php.exe file is being used, correct?

Thanks for other helpful info too.
0
Comment
Question by:SAbboushi
  • 17
  • 8
  • 7
  • +2
35 Comments
 
LVL 11

Accepted Solution

by:
loftyworm earned 75 total points
ID: 40614895
I would use procmon or filemon.  This is a low level tool that will allow you to follow the threads.  But I am just a sysadmin, and this may be the hard way of doing it :)

my two cents
0
 

Author Comment

by:SAbboushi
ID: 40614921
Thanks - good workaround.  I might have to resort to that, but hopefully someone can tell me specifically where to look
0
 
LVL 42

Assisted Solution

by:Chris Stanyon
Chris Stanyon earned 325 total points
ID: 40615438
For the httpd.conf file run:

httpd -V

and look at the SERVER_CONFIG_FILE. It will show something like conf/httpd.conf

In the httpd.conf file, you'll see a line such as:

LoadModule php5_module "c:/wamp/bin/php/php5.5.12/php5apache2_4.dll"

And for full info on your php installation, including the php.ini file that's being used, just create a php file containing the following:

<?php
php_info();
?>

Open in new window


Make sure this is available from your server (for example localhost/pi.php) and open it in your browser. It'll give you all the info you need about PHP
0
 

Author Comment

by:SAbboushi
ID: 40615492
Thanks Chris

look at the SERVER_CONFIG_FILE. It will show something like conf/httpd.conf
the response from -V says "Server compiled with..." which I believe means this is the default location.

Unfortunately, I usually use an alternate serverconfigfile (-f option)

And unless I remember which one I used to install the Apache service (I'm getting old...), I'm looking for a way to see what config file the service is using (not for just this one time, but for future reference too).

Hoping someone can help me figure this out!  I suspect it's in the registry somewhere, but isn't there a simpler way...?

How nice it would be if php_info() told us what php.exe file was being used... but I guess that's an Apache-related issue.
0
 
LVL 42

Expert Comment

by:Chris Stanyon
ID: 40615505
I think on Windows, Apache doesn't use the php.exe - pretty sure it uses the PHP module (the dll file), which is shown in the httpd.conf file (could be wrong though!)
0
 

Author Comment

by:SAbboushi
ID: 40615517
OK - but my question is: how do I know which httpd.conf file Apache is using?
0
 
LVL 42

Expert Comment

by:Chris Stanyon
ID: 40615542
You also asked about php.exe!

If you started the Apache service with command line arguments, then you may be able to see these by checking your Services from the Control Panel.

Failing that, you may just have to search for httpd.conf files and go from there.
0
 

Author Comment

by:SAbboushi
ID: 40615581
You also asked about php.exe!

My apologies - I stand corrected.  I appreciate your efforts--

Unfortunately, services doesn't seem to tell me which httpd.conf file is used for the apache service.

Anyone else?
0
 
LVL 42

Expert Comment

by:Chris Stanyon
ID: 40615583
Sorry SAbboushi - I'm all out of ideas :(
0
 

Author Comment

by:SAbboushi
ID: 40619563
apache error log is one way:
[Thu Feb 19 12:50:21.021483 2015] [core:notice] [pid 15660:tid 544] AH00094: Command line: 'C:\\Apache\\bin\\httpd.exe -d C:/Apache -f D:\\Documents\\Application Data\\Apache\\httpd.conf'

Open in new window


I'm still thinking there's a better way...
0
 
LVL 61

Expert Comment

by:gheist
ID: 40620022
That config file must contain php.ini path.
0
 

Author Comment

by:SAbboushi
ID: 40621549
Good thought -- I just checked but it doesn't.

Instead of playing detective to figure out which apache and php config files are being used, someone's got to know where to look for these config settings!!!
0
 
LVL 61

Expert Comment

by:gheist
ID: 40621651
conf.d/*.conf also counts.
0
 

Author Comment

by:SAbboushi
ID: 40621860
Not sure what that means?  What do I do with that?
0
 
LVL 61

Expert Comment

by:gheist
ID: 40622567
httpd.conf that you found includes line
 Include conf.d/*.conf

So there must be php.conf between those files.
0
 
LVL 29

Assisted Solution

by:fibo
fibo earned 50 total points
ID: 40623137
how many httpd.conf file do you have on your machine? can the file date be of some help to find which one you used last?

If you just have a few of these conf files, in despair I would kill apache, kill one conf file (ie, rename it!), then restart apache and repeat until someting changes..
0
 

Author Comment

by:SAbboushi
ID: 40623331
thanks fibo - I'll add that to the list of workarounds on the table so far.

To be clear, I'm not looking for a workaround.  There must be some way to determine which config file apache is using without resorting to playing detective.  That's the method I'm looking for.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 42

Expert Comment

by:Chris Stanyon
ID: 40623337
If there is a way, then they're keeping a closely guarded secret - nothing I google gives any other suggestions than have already been mentioned here.

You may just have to accept that it's not possible :(
0
 
LVL 61

Expert Comment

by:gheist
ID: 40623376
You installed the software... You must remember the path...
If you have multiple installs you should know which httpd.exe you start and in ../conf/httpd.conf + Includes there should be *php*.dll mentioned as loading (most likely ../conf.d/*.conf are included)

APache does not load random modules.
0
 

Author Comment

by:SAbboushi
ID: 40623406
gheist:
>>You installed the software... You must remember the path...
He he... as I've said, multiple installs, and I'm old, so memory fails me a lot these days!

btw - your suggestion re: /conf/httpd.conf  caused me to look more closely: I'm not finding one as you describe.  Here are the includes:
120 LoadModule include_module modules/mod_include.so
612 Include conf/extra/httpd-autoindex.conf
637 Include conf/extra/proxy-html.conf

Open in new window


However, I do have these lines that I think are relevant:
170 AddHandler fcgid-script .php  
173 FcgidWrapper "c:/php/php-cgi.exe" .php 

Open in new window


I think that means that "c:/php/php-cgi.exe" is the php executable being used?

Chris:
>> You may just have to accept that it's not possible :(
That's not my nature, nor my experience ; )

Wampserver has a menu option in their systemtray utility: Apache->httpd.conf
My suspicion is that the path is not hardcoded because each update of apache in Wampserver puts apache in a folder named with its version # (e.g. C:\wamp\bin\apache\apache2.4.9)... then again, I could be mistaken and they hardcode that menu option each time apache version is upgraded...

So, back to my original question: How do I find out what httpd.conf file apache is using?  Worst case scenario, I can use the apache error log to find the last httpd.conf file used to start apache, which tells me which php dll is being used.

To clarify, I want to be able to, at any point in time, know where to look to figure out what the current apache httpd.conf file is... without having to play detective.  If W7 knows what httpd.conf file to use when launching the apache service, then its location must be stored somewhere, I imaging, at least in the registry.  Would have thought there is a better way for me to identify httpd.conf location other than  tracking down the relevant registry key... e.g. something like Chris suggested re: httpd.exe.
0
 
LVL 42

Expert Comment

by:Chris Stanyon
ID: 40623441
That's not my nature, nor my experience ; )

Nor mine, but it happens!

The httpd.conf option in the WampServer menu gets it's path from the wampmanager.ini file in it's install folder.

the /conf/httpd.conf refers to the default conf file and is a sub folder of your apache folder. On unix systems, the forward slash is used instead of the backslash. On window it refers to something like so:

C:\wamp\bin\apache\apache2.4.9\conf\httpd.conf

But as you say, you chose not to use the default, but to start apache with a different conf.

As I said ealier, Apache doesn't use php.exe. It uses a dll. Once you find out which httpd.conf you're using, it'll be in a line like this:

LoadModule php5_module "c:/wamp/bin/php/php5.5.12/php5apache2_4.dll"

Sometimes, detective work is all you've got. It would be lovely to have 'Click here to tell me everything' button (patent pending!)

As I said many posts ago - I'm all out of ideas, and I've found nothing on google that hasn't already been suggested.
0
 
LVL 61

Assisted Solution

by:gheist
gheist earned 50 total points
ID: 40623461
So you load php via mod_fcgid...
And it is c:\php\php.exe
0
 

Author Comment

by:SAbboushi
ID: 40623739
k found it: looks like if starting without config args, Chris has the best solution:  httpd -V

If starting apache with config args, then I can find them here:
HKLM\System\CurrentControlSet\<Apache service name>\Parameters\ConfigArgs.  

So:
1) See what apache service is running (services will show the executable & service name)
2) Check CurrentControlSet.   If no matching apache service name, then http.conf being used is in default location.  If matching apache service name, then ConfigArgs tells gives me path to http.conf being used.

e.g. on my system, HKLM\System\CurrentControlSet\Apache2.4\Parameters\ConfigArgs shows:  
-f D:\Documents\Application Data\Apache\httpd.conf

Thanks everyone for your help.  With Regards-
0
 
LVL 61

Expert Comment

by:gheist
ID: 40623901
process explorer from microsoft sysinternals shows which files process keeps open, among them httpd.conf
0
 

Author Comment

by:SAbboushi
ID: 40624287
Good thought -- loftyworm shared that earlier too
0
 
LVL 61

Expert Comment

by:gheist
ID: 40624291
I see your memory is improving :P
0
 

Author Comment

by:SAbboushi
ID: 40624296
Ah... wish that this were true... ; )
0
 

Author Comment

by:SAbboushi
ID: 40624300
Hmmm... I just looked in process explorer... not seeing it.  How would I find it?
0
 
LVL 42

Expert Comment

by:Chris Stanyon
ID: 40624335
I'd be surprised if apache kept the conf file open while it's running. My guess would be that it gets read at startup and then binned, so unlikely to show up in any active processes.

If apache is running then it will show as httpd.exe. Depending on your setup, it may well appear under services.exe (under wininit.exe)
0
 
LVL 29

Expert Comment

by:fibo
ID: 40624418
Personally, I happen sometimes to make several installs and to wrongly mix everything.
Then, after some attempts to the more obvious possible solutions, I take the stupid but efficient route of trial and error.

I think this is a similar case.
B-)
0
 

Author Comment

by:SAbboushi
ID: 40624527
Thanks again guys--
0
 

Author Comment

by:SAbboushi
ID: 40637479
Oops... I left out part of the HKLM path:  correction:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Apache2.4\Parameters\ConfigArgs shows:  
-f D:\Documents\Application Data\Apache\httpd.conf
0
 

Author Comment

by:SAbboushi
ID: 40643005
HERE'S the answer I was looking for: localhost/server-info

It's a BEAUTIFUL thing, same concept as phpinfo().  Excerpt:

Server Settings

Server Version: Apache/2.4.12 (Win64)
Apache Lounge VC11 Server Built: Jan 28 2015 14:29:16
Server loaded APR Version: 1.5.1
Compiled with APR Version: 1.5.1
Server loaded APU Version: 1.5.4
Compiled with APU Version: 1.5.4
Module Magic Number: 20120211:41
Hostname/port: 127.0.0.1:80
Timeouts: connection: 60    keep-alive: 5
MPM Name: WinNT
MPM Information: Max Daemons: 64 Threaded: yes Forked: no
Server Architecture: 64-bit
Server Root: C:/Apache2_4_12
Config File: D:/Documents/Application Data/Apache/httpd2_4_12.conf
0
 
LVL 42

Expert Comment

by:Chris Stanyon
ID: 40643448
Excellent - thanks for the update - may come in handy one day :)
0
 

Author Comment

by:SAbboushi
ID: 40643612
yw - thanks for all the time you put into this too.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

First some basics on Windows 7 Backup.  It has 2 components one is a file based backup which is stored in .zip files each zip is split at around 200 Megabytes and there is the Image Backup which is as the name implies a total image of the partition …
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
In this Micro Tutorial viewers will learn how to use Boot Corrector from Paragon Rescue Kit Free to identify and fix the boot problems of Windows 7/8/2012R2 etc. As an example is used Windows 2012R2 which lost its active partition flag (often happen…
This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum editing capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now