php中unable to fork報(bào)錯(cuò)簡單解決方法
今天小編遇到一個(gè)問題,當(dāng)調(diào)用了system方法,并且執(zhí)行了shell腳本,開始的時(shí)候,一切都非常正常,但是當(dāng)程序運(yùn)行后一段時(shí)間,出現(xiàn)了顯示unable to fork的報(bào)錯(cuò),這個(gè)是什么原因呢,后來小編排查了下,主要是因?yàn)檫_(dá)到用戶的進(jìn)程上限了,下面小編給大家介紹下解決方式。
限制linux用戶的進(jìn)程數(shù)
修改以下文件
vi /etc/security/limits.confvpsee hard nproc 32@student hard nproc 32@faculty hard nproc 64
ulimit 不帶 -H 和 -S 參數(shù)的時(shí)候同時(shí)設(shè)置 Hard 和 Soft
ulimit -u65535ulimit -u 65534ulimit -u 65535-bash: ulimit: max user processes: cannot modify limit: Operation not permittedulimit -acore file size (blocks, -c) 0data seg size (kbytes, -d) unlimitedscheduling priority (-e) 0file size(blocks, -f) unlimitedpending signals (-i) 30493max locked memory (kbytes, -l) 64max memory size (kbytes, -m) unlimitedopen files (-n) 65535pipe size (512 bytes, -p) 8POSIX message queues (bytes, -q) 819200real-time priority (-r) 0stack size (kbytes, -s) 10240cpu time(seconds, -t) unlimitedmax user processes (-u) 65534virtual memory (kbytes, -v) unlimitedfile locks (-x) unlimited
查看各系統(tǒng)用戶的進(jìn)程數(shù)
ps h -Led -o user | sort | uniq -c | sort -n2 nobody3 redis34 www64 mysql174 root
確定某用戶的進(jìn)程數(shù)的分布情況
ps -o nlwp,pid,lwp,args -u username | sort -n
問題原因分析:
問題原因
system調(diào)用會(huì)fork新的進(jìn)程,因?yàn)槊總€(gè)用戶有最大進(jìn)程數(shù)限制,簡單的說就是達(dá)到用戶的進(jìn)程上限了
到此這篇關(guān)于php中unable to fork報(bào)錯(cuò)簡單解決方法的文章就介紹到這了,更多相關(guān)php中unable to fork報(bào)錯(cuò)怎么解決內(nèi)容請(qǐng)搜索好吧啦網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持好吧啦網(wǎng)!
相關(guān)文章:
1. CSS自定義滾動(dòng)條樣式案例詳解2. 通過工廠模式返回Spring Bean方法解析3. JSP實(shí)現(xiàn)客戶信息管理系統(tǒng)4. PHP 面向?qū)ο蟪绦蛟O(shè)計(jì)之類屬性與類常量實(shí)現(xiàn)方法分析5. Java Spring WEB應(yīng)用實(shí)例化如何實(shí)現(xiàn)6. python 批量下載bilibili視頻的gui程序7. Intellij IDEA連接Navicat數(shù)據(jù)庫的方法8. 關(guān)于Mysql-connector-java驅(qū)動(dòng)版本問題總結(jié)9. 使用css實(shí)現(xiàn)全兼容tooltip提示框10. python numpy庫np.percentile用法說明
