php中unable to fork報錯簡單解決方法
今天小編遇到一個問題,當(dāng)調(diào)用了system方法,并且執(zhí)行了shell腳本,開始的時候,一切都非常正常,但是當(dāng)程序運(yùn)行后一段時間,出現(xiàn)了顯示unable to fork的報錯,這個是什么原因呢,后來小編排查了下,主要是因?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è)置 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)用會fork新的進(jìn)程,因?yàn)槊總€用戶有最大進(jìn)程數(shù)限制,簡單的說就是達(dá)到用戶的進(jìn)程上限了
到此這篇關(guān)于php中unable to fork報錯簡單解決方法的文章就介紹到這了,更多相關(guān)php中unable to fork報錯怎么解決內(nèi)容請搜索好吧啦網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持好吧啦網(wǎng)!
相關(guān)文章:
1. ASP實(shí)現(xiàn)加法驗(yàn)證碼2. CSS可以做的幾個令你嘆為觀止的實(shí)例分享3. ASP刪除img標(biāo)簽的style屬性只保留src的正則函數(shù)4. PHP循環(huán)與分支知識點(diǎn)梳理5. PHP session反序列化漏洞超詳細(xì)講解6. jsp+servlet簡單實(shí)現(xiàn)上傳文件功能(保存目錄改進(jìn))7. ASP基礎(chǔ)入門第二篇(ASP基礎(chǔ)知識)8. Spring注入Date類型的三種方法總結(jié)9. ASP基礎(chǔ)知識Command對象講解10. ASP動態(tài)網(wǎng)頁制作技術(shù)經(jīng)驗(yàn)分享
