Wampserver write permissions

Daniele Brunengo
Daniele Brunengo used Ask the Experts™
on
Hello, so I'm trying to mirror some website from my LAMP server to my Windows 10 PC.
I am using WAMP server to do this but I have huge problems with permissions.

Apache can't seem to write stuff anywhere. The service runs as local system and the SYSTEM user has full control. I also tried giving EVERYONE full control, it still doesn't work. I keep getting errors like this:

Warning: error_log(../xxxxxxxxxxx/00000b015e503ae39081e38d06f1652e822b20171116.log): failed to open stream: Permission denied in B:\Siti\xxxxxxxxx\xxx.php on line 708

Open in new window


I also tried running Apache as a local administrator, still no go.

There must be a way to make this work. I have a CentOS vm on and I could use that, but it would be handier for me to go full local.
Also, I can't stand things not working.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Distinguished Expert 2018

Commented:
What is B:? Did you map B: to some drive?
Daniele BrunengoIT Consultant, Web Designer

Author

Commented:
Yes, I've been using B: and A: as drives for years.
Distinguished Expert 2018

Commented:
So what did you map b: to? "What is behind B"?
Fundamentals of JavaScript

Learn the fundamentals of the popular programming language JavaScript so that you can explore the realm of web development.

Daniele BrunengoIT Consultant, Web Designer

Author

Commented:
It's a partition on a physical drive.
Distinguished Expert 2018

Commented:
Could you localize the contents of "line 708"?
David FavorLinux/LXD/WordPress/Hosting Savant
Distinguished Expert 2018

Commented:
I think the clues are in the .log file name.

Look at the filename closely. It's a relative filename, rather than absolute.

This means, wherever Apache or FPM starts up, then you'd have to arrange to create the "/xxxxxxxxxxx/" directory relative to ".." for this to work.

A recipe for disaster, as anytime your higher level (parent) directories change, then you'll have to manage their ownerships.

First start with absolute files for all your logging.

Once this works, you can (shudder) move to relative paths if you really must.

I host 100s of high traffic + high speed WordPress sites. I make all PHP + Apache + MariaDB log file paths absolute, so I never have to guess about directory paths.

Try this + see if your problem disappears.
Daniele BrunengoIT Consultant, Web Designer

Author

Commented:
You're devoting too much attention to that particular example I made. Apache (and therefore php) can't write anything anywhere on the machine. That was just an example, but I get similar errors every time there is a php write operation.

The problem is with Wamp and permissions. There are tons of threads around but nobody seems to have found a solution working for everybody.
Distinguished Expert 2018
Commented:
Please download procmon from microsoft, start it and monitor the access denials. Save the filtered log (filtered for term "access denied") and upload the log.
Daniele BrunengoIT Consultant, Web Designer

Author

Commented:
Ok, I caught it. It was an antiransomware routine I forgot about.
Olaf DoschkeSoftware Developer

Commented:
In regard of Everyone, look at https://weaselfire.wordpress.com/2009/07/09/everyone-isnt-everyone/

If you run Apache ass Windows Service, then it runs in Session 0, another thing to learn here: https://msdn.microsoft.com/en-us/library/windows/hardware/dn653293(v=vs.85).aspx

Session 0 is not seeing any drive mapping you do, so you can't let Apache access shares, no matter what permissions you set. So if B is created as a mapped drive letter and not really a physical drive, this won't work out. Apache/PHP might not consider B a local hard drive, as A and B are reserved for floppy drives, that might also play a role.

If you look into Services in the task manager, you should find wampapache and wampmysqld services runing as LocalSystem account.
If giving explicitly giving full permission to the Webroot folder to LocalSystem doesn't work, it fails on B:\ not visible to Session 0.

Bye, Olaf.
Daniele BrunengoIT Consultant, Web Designer

Author

Commented:
No, B is a physical drive. It was the antiransomware locking httpd. Now it works. Thanks.
Olaf DoschkeSoftware Developer

Commented:
I started my answer before you posted the solution, so forget it.

When you run httpd.exe you run a "normal" process under your account, then the whole stuff about Session 0 and LocalSystem won't matter anyway. But I also don't see much references to that. Running Wampserver really as service still is less popular than httpd.

XAMPP also does so on Windows, simply runs httpd as normal process in your normal account.

Bye, Olaf.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial