1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

exec(): Unable to fork

Discussion in 'Site & Server Administration' started by digitalpoint, Jul 27, 2005.

  1. #1
    Has anyone seen something like this? Make a call with exec(), and sometimes (but not always), you get a PHP error about being unable to fork...

     
    digitalpoint, Jul 27, 2005 IP
  2. Shoemoney

    Shoemoney $

    Messages:
    4,474
    Likes Received:
    588
    Best Answers:
    0
    Trophy Points:
    295
    #2
    shell_exec()

    =)
     
    Shoemoney, Jul 27, 2005 IP
  3. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,333
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #3
    I didn't try it with shell_exec() (or any of the other variants), but I wouldn't think they would work any different. No clue why PHP is trying to fork it internally, and really no idea why it can't do it (it can about 50% of the time). Weird.
     
    digitalpoint, Jul 27, 2005 IP
  4. frankm

    frankm Active Member

    Messages:
    915
    Likes Received:
    63
    Best Answers:
    0
    Trophy Points:
    83
    #4
    probably too many processes in that shell (php thread or apache process)

    check your /etc/login.conf or /etc/*/limits.conf
    and increase the number of processes the apache/httpd uid can have

    or use system() :)
     
    frankm, Jul 27, 2005 IP
    digitalpoint likes this.
  5. Shoemoney

    Shoemoney $

    Messages:
    4,474
    Likes Received:
    588
    Best Answers:
    0
    Trophy Points:
    295
    #5
    ay system() was my next sugestion

    Is this a windows box? I ran into this before with friends who had 2k3 servers....
     
    Shoemoney, Jul 27, 2005 IP
  6. frankm

    frankm Active Member

    Messages:
    915
    Likes Received:
    63
    Best Answers:
    0
    Trophy Points:
    83
    #6
    Oops. i assumed it was a unix box :) if it IS a windows server -- you're on your own :) haha
     
    frankm, Jul 27, 2005 IP
  7. Shoemoney

    Shoemoney $

    Messages:
    4,474
    Likes Received:
    588
    Best Answers:
    0
    Trophy Points:
    295
    #7
    looks like this box is unix ;)

    SSL Cert: www.digitalpoint.com SSL is expired!
    Alexa Trend/Rank: A higher rank means less popular. 534 (1 Month) 521 (3 Month)
    DMOZ: 12 listings
    Y! Directory: 4 listings
    Website Status: Active
    Reverse IP: Web server hosts 7 websites
    Server Type: Apache/1.3.20 Sun Cobalt (Unix) mod_ssl/2.8.4 OpenSSL/0.9.6 mod_auth_pam_external/0.1 mod_perl/1.26
     
    Shoemoney, Jul 27, 2005 IP
  8. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,333
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #8
    Different machine... this one is Mac OS X Server (BSD variant). It doesn't have the limits.conf file like my Red Hat machines do, but I think you are on to something, because this particular machine has been serving up about 1,000 hits/second. :) God damn high traffic machines. heh
     
    digitalpoint, Jul 27, 2005 IP
  9. Shoemoney

    Shoemoney $

    Messages:
    4,474
    Likes Received:
    588
    Best Answers:
    0
    Trophy Points:
    295
    #9
    ohh shawn -

    look in /etc/sysctl.conf
    put in sysctl kern.maxproc=12000000000


    OR to do it without rebooting do

    sysctl -w kern.maxprocs=1000000


    that will fix you for sure.
     
    Shoemoney, Jul 27, 2005 IP
    digitalpoint likes this.
  10. frankm

    frankm Active Member

    Messages:
    915
    Likes Received:
    63
    Best Answers:
    0
    Trophy Points:
    83
    #10
    BSD uses /etc/login.conf i think
     
    frankm, Jul 27, 2005 IP
  11. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,333
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #11
    Nope, no login.conf file either... but I think Shoemoney is right with sysctl.conf, thanks... that should get me something to work with.
     
    digitalpoint, Jul 27, 2005 IP
  12. Shoemoney

    Shoemoney $

    Messages:
    4,474
    Likes Received:
    588
    Best Answers:
    0
    Trophy Points:
    295
    #12
    i got 50$ that says it fixes it =P
     
    Shoemoney, Jul 27, 2005 IP
  13. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,333
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #13
    I ended up doubling the two values to now be this:

    kern.maxproc=4096
    kern.maxprocperuid=2000
    Code (markup):
    Only problem is I bet you need to reboot for those to take affect, which I don't really want to do. hehe
     
    digitalpoint, Jul 27, 2005 IP
  14. Shoemoney

    Shoemoney $

    Messages:
    4,474
    Likes Received:
    588
    Best Answers:
    0
    Trophy Points:
    295
    #14
    reread what i wrote brotha... i have no reboot option also ;)
     
    Shoemoney, Jul 27, 2005 IP
  15. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,333
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #15
    Guess I should have read about the sysctl -w you just told me about, huh? :)

    Problem is it's not letting me set kern.maxproc higher than 2068. Weird... set it to 2068 and set kern.maxprocperuid to 1500 for now.
     
    digitalpoint, Jul 27, 2005 IP
  16. frankm

    frankm Active Member

    Messages:
    915
    Likes Received:
    63
    Best Answers:
    0
    Trophy Points:
    83
    #16
    try changing the values with sysctl or sysctl -w
     
    frankm, Jul 27, 2005 IP
  17. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,333
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #17
    I did... using a value higher than 2068 gives Invalid argument.
     
    digitalpoint, Jul 27, 2005 IP
  18. wkw

    wkw Well-Known Member

    Messages:
    205
    Likes Received:
    30
    Best Answers:
    0
    Trophy Points:
    148
    #18
    sudo sysctl -w kern.maxproc=5000

    change 5000 to your desire... though there may be diminishing returns going too high.
     
    wkw, Jul 27, 2005 IP
  19. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,333
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #19
    kern.maxfiles is set to 12288 by default.
     
    digitalpoint, Jul 27, 2005 IP
  20. frankm

    frankm Active Member

    Messages:
    915
    Likes Received:
    63
    Best Answers:
    0
    Trophy Points:
    83
    #20
    mmm. i wrote my 'try this ...' message while you were trying it I guess :)

    the max processes (system wide, not per user) on FreeBSD (4.x and 5.x, dunno what Mac is using) is calculated based on the max concurrent users set in the kernel config (compile time)

    I got
    
    maxusers        512
    
    Code (markup):
    somewhere in that file,
    but the GENERIC config only mentions 32..
     
    frankm, Jul 27, 2005 IP