<p>I'm asking for help with what I think is a non-trivial question that I've been trying to solve for a few weeks now.</p>
<p>I recently upgraded my project to Symfony 5.4. However, after deploying the project to a Kubernetes cluster, php-fpm stopped working in pods. I wrote more about this process <a href="https://stackoverflow.com/questions/76153171/php-fpm-not-working-on-the-kubernetes-pod-after-upgrade-symfony">here</a>. I was immediately sent to look at logs, conifigs and so on, but I made sure that there was no problem with that. And here's why:</p>
<p>The fact is that in order to reproduce the problem, ALWAYS(!) two conditions are needed:</p>
<ol>
<li>Symfony 5.4 packages</li>
<li>A remote Kubernetes cluster.</li>
</ol>
<p>In all other cases, the problem does NOT(!) reproduce.</p>
<p>This means that if I, while in a Kubernetes cluster, rollback packages to version 4.4 and everything works fine. On the other hand, on my local machine where there is no Kubernetes cluster, after updating the project to version 5.4, php-fpm also works fine. Both configs are the same, php-fpm versions are the same. Everything is literally identical. From this I conclude that the remote configs are configured correctly and there is no fundamental incompatibility of Symfony packages with the installed fpm.</p>
<p>I thought that maybe not enough resources to start/update the system, but:</p>
<ol>
<li>Composer updated the project during the build stage, but the problem occurs during the deployment stage.</li>
<li>I don't think the Kubernetes cluster is so loaded that it can't handle the simple task that my laptop can handle.</li>
<li>There are no signals from Kubernetes that there is not enough memory or anything else. The cluster just ignores running php-fpm without a single message.</li>
</ol>
<p>So, what can be the problem?</p>
<p><strong>UPD:</strong></p>
<p>I can watch the pod logs and I can see how my <code>entrypoint</code> file is executed, by this:</p>
<ol>
<li><p>After performing all migrations, the log file shows the entry <code>[OK] Already at the latest version (&quot;App\Migrations\Version20230427064413&quot;)</code>. From this I conclude that the migrations worked successfully and didn't break my application.</p>
</li>
<li><p>Cache warming up is successful, as evidenced by the line in the logs <code>[OK] Cache for the &quot;prod&quot; environment (debug=false) was successfully warmed.</code></p>
</li>
<li><p>In the entrypoint given <a href="https://stackoverflow.com/questions/76153171/php-fpm-not-working-on-the-kubernetes-pod-after-upgrade-symfony">here</a> I really don't use the <code>$ php-fpm --test</code> command, however, I can assure you that I have run the command with the <code>-t</code> flag and <code>--debug</code> flag before and there were no errors. The logs show <code>NOTICE: configuration file /usr/local/etc/php-fpm.conf test is successful</code>.</p>
</li>
<li><p>This is my problem, yes.</p>
</li>
<li><p>My Symfony 4.4 project runs on the same base image <code>php:8.0-fpm-alpine3.16</code> in exactly the same Kubernetes pod configuration, from which I conclude that OPcache is compatible with PHP version 8.0. However, to be even more sure, I commented out the lines <code>;opcache.preload=/var/www/app/var/cache/prod/srcCimple_KernelProdContainer.preload.php ;opcache.preload_user=www-data</code> in my <code>php.ini</code> and the problem did not go away</p>
</li>
</ol>
<p><strong>UPD 2</strong></p>
<ol>
<li><p>I tried to print out the code that the <code>php-fpm -F</code> command returns. The output is <code>0</code>, which indicates successful completion of the command, with no errors.</p>
</li>
<li><p>That's what I tried to do, I first separately update the recipes, prepare the code and make sure that at each step the project runs. The problem is that the project runs locally even with a fully updated Symfony. The problem with php-fpm happens as soon as I update <code>composer update &quot;symfony/*&quot; </code> from 4.4 to 5.1 or higher. Or should I try to update packages one by one ? Is it possible ?</p>
</li>
<li><p>I left only one line in <code>index.php</code> - <code>require dirname(__DIR__).'/vendor/autoload.php;</code> and the problem is still there.</p>
</li>
</ol>
<p>I was able to find out some more information about this bug: there are lines in the <code>entrypoint</code> file</p>
<p><code>php-fpm -F &amp;</code></p>
<p><code>nginx -g 'daemon off;' &amp;</code></p>
<p>So, I commented out the line with <code>nginx</code> and found out that <code>php-fpm</code> works correctly in this case. Hence, no problem with PHP FPM as such, the problem is that the command <code>nginx -g 'daemon off;' &amp;</code> somehow blocks my fpm. Could it be related to the new rules for nginx config in Symfony 5.4 ?</p>
<p>I have created a new <a href="https://stackoverflow.com/questions/76201223/nginx-blocks-php-fpm-process">question</a>.</p>

Roman Zagday
<ol>
<li><p>You run <code>app:migrations:migrate</code> which can fail the script (should be done in initContainer).</p>
</li>
<li><p>You run <code>cache:warmup</code> which can fail the script.</p>
</li>
<li><p>You do not run <code>$ php-fpm --test</code>, to verify that you config actually valid.</p>
</li>
<li><p>You update <code>symfony</code>, which may contain bugs, which appears only on cloud hardware.</p>
</li>
<li><p>You using JIT (OPcache) and it just not work (8.0, 8.1 problem). You can try disable opcache extension.</p>
</li>
</ol>
<hr />
<p>Try to connect to the pod and run project through builtin php server, not php-fpm, if it still not runs, then try to change php version.</p>
