PHP Fatal Error: apc_mmap

Hi there,
I’m trying the self-hosting. I followed the instructions on the gitlabs README, I have in place all DNS records as described. The installation script works well for a good while, however at the end it breaks with following error message:

Tue Dec 15 10:26:46 UTC 2020: Waiting for Nextcloud to finish installation…PHP Fatal error: apc_mmap: Failed to mmap 33554432 bytes. Is your apc.shm_size too large? in Unknown on line 0

Any hint how to avoid this or fix for this problem would be really appreciated.

Thanks a lot in advance.


I think it would help if you can give some more details about the system you try to do the self-hosting on. Is it a RasPi, some hosted server, cloud, etc.? What operating system are you using?

You’re right. It’s a Ubuntu 18.04 LTS (x64) VM hosted on DigitalOcean.

Maybe you can check items 5 and 6 of

How much RAM has this VM ?
Is swap activated ?
Could you please paste output of free -m ?

Thanks for your replies.
The VM has 1 G RAM. It looks like swap is not activated.
eramon@mail:~$ free -m
total used free shared buff/cache available
Mem: 985 756 71 4 157 81
Swap: 0 0 0

Regarding shared memory:
eramon@mail:~$ df -k /dev/shm
Filesystem 1K-blocks Used Available Use% Mounted on
tmpfs 504412 12 504400 1% /dev/shm
eramon@mail:~$ ipcs -lm

------ Shared Memory Limits --------
max number of segments = 4096
max seg size (kbytes) = 18014398509465599
max total shared memory (kbytes) = 18014398509481980
min seg size (bytes) = 1

Hm, those outputs don’t look problematic. The error message to me sounds like it’s not possible to allocate 32MB of shared memory. The shared memory limits are certainly large enough. And there’s also more than 32MB of free RAM in general.

My only guess is that on startup “non-shared” RAM gets allocated. And at the point the 32MB shared memory are allocated, the system has already run out of (enough) RAM.
Maybe monitoring the RAM usage while the install script is running gives more insights?

Edit: strictly speaking your system doesn’t meet the minimum of 2 GB RAM (see, i.e. it might be pointless to try and “squeeze” it in your server

1 Like

Indeed, resizing the VM to 2 GB RAM was enough to solve this issue. Thanks a lot for your help.


As @Ingo_FP_Angel stated ,please read carefully all Requirements at :wink:

Additionally, a 1~2GB swap file may be helpful (man mkswap, see NOTES about creating a swap file).
Don’t forget to add it to fstab (/swapfile swap swap defaults 0 0) and activate it (swapon -a) :wink:
Later, with all running fine, you could examine swap usage (swapon, top, htop, nmon, …) and choose to remove it (swapoff, edit fstab, rm).
Note : I don’t know about DigitalOcean, but some hosting may propose dedicated swap storage.

I will do so, thank you a lot :slight_smile: