0

I'm having a embedded device with a running OpenWrt Linux. I have installed and configured the pakages php5-fastcgi and nginx like described on OpenWrt Wiki: https://wiki.openwrt.org/doc/howto/http.nginx Furthermore I have installed the packages php5-mod-session and php5-mod-sockets.

Everything seems to work correctly basic files like images, static HTML pages etc. as well as PHP scripts.

My web page has a JS script (AJAX) which polls a PHP script every second. After about 5 to 10 minutes nginx responses with a 502 Bad Gateway error on all PHP pages. If I check the running process on my linux machine I can see that the process php5-fastcgi isn't running anymore. The PHP log is empty and the log of Nginx shows the connection error to the FastCGI server of PHP only.

I know there are lot of topics about this on the internet but I didn't find a solution yet.

Maybe anyone could help! Thanks for all suggestions!

  • I would start by checking the log levels of PHP-FPM, set it to debug. It should at a minimum say "starting up now", but once it's working should give you some good clues about what's up. Once a second seems very fast for PHP on an embedded device, PHP is quite heavy. It may run out of RAM and kill the process. Check memory usage with top. Also configure the number of PHP workers to 1 or 2, to see what happens. – Tim Jul 20 '17 at 19:20
  • PHP-FPM is a separate package (php5-fpm) which replaces php5-fastcgi. Is that correct? – Benjamin J. Jul 20 '17 at 19:32
  • Sorry I can't answer that for sure, but I suspect they're different. I know I use php-fpm with Nginx on Amazon Linux and it works well. – Tim Jul 20 '17 at 19:45
  • OK. Thanks so far. I will try to install php5-fpm. – Benjamin J. Jul 20 '17 at 19:54
0

I don't really know what causes my issue with PHP and Nginx. But after replacing php-fastcgi through php-fpm everything seems to work now.

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.