Apache error log with mmap cache errors
Asked Answered
L

3

8

I found many errors like this one

[Wed Nov 06 14:34:01 2013] [warn-phpd] mmap cache can't open C:\www\somefile.php (pid 4484 th 1668)

in my Apache error.log file. I tried to pinpoint the source of the error for some time but with no luck so far.

  • I find out that PHP Opcache is not the culprit.
  • error_log did not help. I think that my PHP source codes do not affect the error.

My stack: Apache 2.4.6, Windows, PHP 5.4.20

Did anyone encounter the same error?

Note: The error message I get is not the same as, for example, the error:

Mon Dec 1 21:08:20 2008] [warn-phpd] mmap cache can't open /var/www/vhosts/domain.com/httpdocs/file.php - Permission denied (pid 7831)

where there is a reason why mmap can't open the file.

Loleta answered 6/11, 2013 at 13:57 Comment(5)
In the error message after the file name and before the process/thread ids isn't there any more meaningful information? Otherwise checking the permissions, if the file is accessible by the webserver seems to be a good starting point.Bailar
Unfortunately, there is no more information about the error. We checked permissions several times and we did not find any mistake.Loleta
is file.php attempting to write or read or edit a file on the file system? does the web user running apache have permissions to read the file being opened by file.php? See atomicorp.com/forums/viewtopic.php?f=2&t=2960 for more detailsOcean
This looks suspicious. mmap() is a Linux call. The windows equivalent, AFAIK, is CreateFileMapping() and that is what should have been reported in the log. I came to this question because I saw mmap in the question title and could have helped you do some hard-core debugging on a Linux box but am useless with Windows. I'd suggest you add a tag of Windows to the question.Felecia
How are you running PHP - As a CGI script, FastCGI script or mod_php?Felecia
L
0

This is caused by the total number of files that are opened by the server. If this is on a hosting company then they would be able to resolve this for you, if you are on your own system then try these steps:

  1. Edit the apache startup script, \Program Files\Apache Software Foundation\Apache2.2\etc\init.d\httpd (may be different on your system) and add this before anything else:
  2. ulimit -n 20480 #Raise the ulimit to a higher value then you have
  3. Then Restart apache using httpd.exe restart

Hope this points you in a general direction

Lamoree answered 13/11, 2013 at 14:41 Comment(6)
The error message would be presumably different if the problem was caused by too many opened files - see: forum.parallels.com/… Apache is installed on Windows and the limit for maximum opened files is much higher than 10k files. So I believe that's not the real problem I'm experiencing.Loleta
Check the file permissions, usually it means the world is set to 0, like 640 or 750, try changing it to 644 or 755 see if that helps. Permissions are kind of strange to, for example if you have a group:user such as 540:125 and the file is saved as 0:0 (which is root), that would cause that too.Lamoree
I checked permissions several times.Loleta
What about the file ownership... That is where I have the most issues, a file is created by root and only the user has access to it. You can check by using shell go to the directory and ls -lah it will list all of the permissions, files, size, date and ownership. If the ownership matches then I am out of ideas. It really has to be something simple like this. The only other thing I can think of is drive space. Actually, I think I remember something about inodes too, it has been a long time, but if there are too many inodes that is like not enough disk space. I will see if I can find out more.Lamoree
BTW: If it is ownership, then a simple chown {user}:{group} {filename} will do the trick. For example, if you do the ls -lah and see hvac3:hvac3 on most of the files, and the the file is something like root:root, you can chown hvac3:hvac3 somefile.phpLamoree
Here is what I found doing a quick google search: serverfault.com/questions/185553/…Lamoree
E
0

Disable MMAP. It's not supported on Windows.

It's an efficient method to map files to memory, to work on their content. Similar story with sendfile, an efficient method to send the content of a file as a response.

# https://httpd.apache.org/docs/2.4/en/mod/core.html#enablemmap
EnableMMAP On
EnableSendfile Off
Edelweiss answered 4/2, 2019 at 1:58 Comment(0)
A
-1

Mon Dec 1 21:08:20 2008] [warn-phpd] mmap cache can't open /var/www/vhosts/domain.com/httpdocs/file.php - Permission denied (pid 7831)

It seems that mmap doesn't has the rights to open the file, check file's folder rights . Check file's folder properties .

Angelesangelfish answered 11/11, 2013 at 11:23 Comment(1)
Please read my question carefully again. I wrote: "The error message I get is not the same as, for example, ..."Loleta

© 2022 - 2024 — McMap. All rights reserved.