1

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?

sotirov
  • 4,379
Kevin
  • 354
  • 1
  • 4
  • 23

2 Answers2

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.

Kevin
  • 354
  • 1
  • 4
  • 23
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.

Ryan
  • 11