SoFunction
Updated on 2025-03-10

Simple solution to report errors in php

Limit the number of processes for linux users

Modify the following files

vi /etc/security/
vpsee hard nproc 32
@student hard nproc 32
@faculty hard nproc 64

When ulimit does not have the -H and -S parameters, set Hard and Soft at the same time.

ulimit -u
65535
ulimit -u 65534
ulimit -u 65535
-bash: ulimit: max user processes: cannot modify limit: Operation not permitted
ulimit -a
core file size     (blocks, -c) 0
data seg size      (kbytes, -d) unlimited
scheduling priority       (-e) 0
file size        (blocks, -f) unlimited
pending signals         (-i) 30493
max locked memory    (kbytes, -l) 64
max memory size     (kbytes, -m) unlimited
open files           (-n) 65535
pipe size      (512 bytes, -p) 8
POSIX message queues   (bytes, -q) 819200
real-time priority       (-r) 0
stack size       (kbytes, -s) 10240
cpu time        (seconds, -t) unlimited
max user processes       (-u) 65534
virtual memory     (kbytes, -v) unlimited
file locks           (-x) unlimited

Check the number of processes of users of each system

ps h -Led -o user | sort | uniq -c | sort -n
2 nobody
3 redis
34 www
64 mysql
174 root

Determine the distribution of the number of processes of a user

ps -o nlwp,pid,lwp,args -u username | sort -n

Analysis of the cause of the problem:

Cause of the problem

System calls will fork a new process, because each user has a maximum number of processes limits. In short, it will reach the user's process limit.

This is the article about the simple solution to the error report of unable to fork in PHP. For more related content on how to solve the error report of unable to fork in PHP, please search for my previous articles or continue browsing the related articles below. I hope everyone will support me in the future!