Laravel Forge — How to fix too many open files error in a queue?

Farid Movsumov
Mar 21, 2024


I had this weird error where my jobs in the queue were getting an error message about too many open files. The Laravel Forge support team helped me solve the problem.

If this happens only in a queue, you should set the configuration in the /etc/supervisor/supervisord.conf


See what the full configuration should look like.

Laravel Forge — Supervisor configuration for too many open files.

Additionally, you can find the official documentation on the Forge website here. Basically you should set the following configurations on your server.

File: /etc/sysctl.conf

fs.file-max = LIMIT_HERE

File: /etc/security/limits.conf

root soft nofile LIMIT_HERE
root hard nofile LIMIT_HERE
forge soft nofile LIMIT_HERE
forge hard nofile LIMIT_HERE

It is hard to reproduce this issue, so I assume it is fixed. I hope this will save you some time.