0

I keep receiving an error on my Ubuntu 16.04 server with PHP 7 FPM

ERROR: fork() failed: Resource temporarily unavailable (11)

Which results in none of my sites working with a 502 error.

NOTE: I am using the ondrej repo for php7, and have the following modules installed (if it helps any....)

php7.0-fpm php7.0-cli php7.0-curl php7.0-gd php7.0-intl php7.0-mysql php7.0-json php7.0-sqlite3 php7.0-opcache php-memcached php-pear

And utilize nGinx

How can I fix this?

3
  • This looks like it might be relevant unix.stackexchange.com/a/274830/880 but I'm in no position to test. See if it helps and if it does, use it to write an answer here to help other people in the same sitch :) – Oli Apr 28 '16 at 12:29
  • Aye mate, tried that yesterday :) got an error tho... invalid unlimited, but I used a really high number and same situation, same error message :) – Kevin Apr 28 '16 at 12:32
  • I almost hate saying this... because ondrej in a genius... but I will post in an answer – Kevin Apr 28 '16 at 12:45
2

In order to solve my issues, I needed to purge php7 from my server, remove the ondrej repo, and install everything from the Ubuntu repos.

My Steps:

apt-get --purge remove php7*
rm -f /etc/apt/sources.list.d/ondrej*
apt-get update && apt-get -y upgrade #just for safeties sake
apt-get -y install php7.0-fpm php7.0-curl php7.0-gd php7.0-intl php7.0-mysql php7.0-json php7.0-sqlite3 php7.0-opcache php-memcached php-pear

And now all is well.

3
  • 1
    This is strange. I am guessing this might be some upstream PHP problem, as I think there were any changes between what Ubuntu has and my repos has apart from 7.0.4 vs 7.0.5 – oerdnj Apr 29 '16 at 10:04
  • 1
    I would be glad if you could retry with 7.0.6 later today (I am in process of updating PPA to new PHP releases right now). – oerdnj Apr 29 '16 at 10:07
  • 1
    I'm honored mate, that you are commenting on one of my questions! :D :D Big time! I will certainly try later on – Kevin Apr 29 '16 at 18:17
1

I was having the same issue with PHP-FPM seemingly "stuck" around 500 child processes and not being able to fork more because of the error "Resource temporarily unavailable".

Based on a comment above from Oli, I looked into https://unix.stackexchange.com/a/274830/880

This was the fix for me, related to the default task limit that systemd puts in place (in my case it was 512). I ran "systemctl edit php-fpm", added the following lines:

[Service]
TasksMax=infinity

Then ran systemctl daemon-reload and systemctl restart php-fpm.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.