logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Apache 2.2 as a service - no access to smb network
Author
michaelbender



Joined: 21 Mar 2007
Posts: 2
Location: 155 Gaither Dr, Mt Laurel NJ, 08054, USA

PostPosted: Wed 21 Mar '07 20:28    Post subject: Apache 2.2 as a service - no access to smb network Reply with quote

I have installed the apache 2.24 that I found here. (awsome btw)

I am trying to run it as a service and connect up to an ms access db through a windows network (SMB) share. But alas I find that no matter what I do I can't reach any network resources once I run apache as a service. I have tried both db access and direct file access. It runs fine if it points to my local machine but nothing if it points to the network. Now if I run apache in a console I can connect to anything I want. My little test reads local and network no problem.

So I look through apache docs and find some instructions.
I use nice little domain user that I created with logon as service and interact with desktop privileges as well as full access to the share in question. I set the service to run as that user.

No dice.

Does anyone have this working. Any Ideas.
Any help would be most welcome.

Thanks,

Michael Bender
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7298
Location: Germany, Next to Hamburg

PostPosted: Fri 23 Mar '07 14:29    Post subject: Reply with quote

When you run the service.
Can you reach your Apache under http://localhost or http://localhost:8080 ?
Disable all firewalls (included windows firewall) and virusscanners.
Try again.
Back to top
michaelbender



Joined: 21 Mar 2007
Posts: 2
Location: 155 Gaither Dr, Mt Laurel NJ, 08054, USA

PostPosted: Mon 26 Mar '07 16:58    Post subject: Reply with quote

James,

Thanks for the reply. I can get to apache fine as a service or running as an app. Localhost or any of my virtual hosts work great.

The only difference is when I try to connect to somthing from a network resource. i.e. a text file or an access database. This only works when I run httpd.exe from a console.

I set the service to run as a user I have set up. I even set it up to run as domain admin with every right and privilage I can dream up. It just wont work. Running from the console I can write to files and to the db. when I switch to the service I can only write to textfiles and db's that live localy on the webserver.

I have gone through the 2.2 docs for running it as a service and I feel like I am doing everything they ask. I know its somthing stupid but for the life of me I just cant see it.

Thanks again, and any suggestions would be welcome.

Michael
Back to top
jlynch



Joined: 23 Apr 2007
Posts: 1

PostPosted: Mon 23 Apr '07 4:38    Post subject: Reply with quote

I also had the problem you are describing and I believe it is XP specific as I have apache cgi's accessing mapped network drives between W2K - W2k however XPSP2 -> W2k with apache running on XP fail. The problem comes about with XP services not having access to device mappings created while logged in as another user, even if the service is running as that user. The solution's I found were to use UNC path names as opposed to mapped network drives or programitically(sp ?) create the mapping with in the CGI,
and if the mapping is persistant then other CGI's will then have access to the resource. (Note that you will also have to delete the share programactically as well as the share won't be visible to the user you are logged in as. Heres an incomplete code sample:

#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <winnetwk.h>

FILE *F;
char Line[500];
NETRESOURCE NR;
DWORD res;

int main(void) {
NR.dwType = RESOURCETYPE_DISK;
NR.lpLocalName = "k:";
NR.lpRemoteName = "\\\\somepc\\some share";
NR.lpProvider = NULL;
res = WNetAddConnection2(&NR, "some-passoword", "some username", 0);
printf("Content-Type: Text/HTML\n\n");
if (res != NO_ERROR) {
printf("Network drive map failed with error code %d", res);
return res;
}
}

hope this helps.
Back to top


Reply to topic   Topic: Apache 2.2 as a service - no access to smb network View previous topic :: View next topic
Post new topic   Forum Index -> Apache