Previously successful PHP builds now fail
When building a PHP app, Upsun runscomposer install, which by default runs the latest available Composer version.
Composer version 2.9 introduces an Automatic Security Blocking feature, which is enabled by default and does the following:
- If a dependency in the project has a known vulnerability, Composer fails the installation/update.
- If a dependency is abandoned, Composer can optionally fail the installation.
.dependencies.php.config.audit.* keys described in the Configure security blocking section of the PHP topic.
Important: Upsun advises against disabling security blocking. However, as a last resort, the feature can be disabled as a workaround while you fix issues with dependencies.
Server reached max_children
If the server is receiving more concurrent requests than it has PHP processes allocated,
you encounter a message like the following:
- Adjust the worker sizing hints for your project.
- Add additional resources with the
upsun resources:setcommand
Execution timeout
If your PHP app can’t handle the amount of traffic or is slow, you encounter a message like the following:max_execution_time value in php.ini,
but there is still a hard cap of 5 minutes on any web request.
The most common causes of a timeout are an infinite loop (which is a bug that you should fix)
or the work itself requires a long time to complete.
For the latter case, you should consider putting the task into a background job.
The following command identifies the 20 slowest requests in the past hour,
which can provide an indication of what code paths to investigate.
- Find the most visited pages and see if they can be cached and/or put behind a CDN. Refer to how caching works.
- Add additional resources with the
upsun resources:setcommand
Troubleshoot a crashed PHP process
If your PHP process crashed with a segmentation fault, you encounter a message like the following:Troubleshoot a killed PHP process
If your PHP process is killed by the kernel, you encounter a message like the following:- Check if the memory usage of your app is as expected and try to optimize it.
- Use sizing hints to reduce the amount of PHP workers, which reduces the memory footprint.
- Add additional resources with the
upsun resources:setcommand
Restart PHP processes stuck during a build or deployment
If your build or deployment is running longer than expected, it might be because of a PHP process getting stuck. To restart your PHP processes, run the following command in your app container:Resource temporarily unavailable
If all PHP workers are busy, you encounter a message like the following:- Lower the memory consumption of each request so that the amount of PHP workers gets automatically raised.
This can be customized with the
runtime.sizing_hints.request_memorykey in your.upsun/config.yamlfile. For more details, consult PHP-FPM sizing. - Add a CDN.
- Set up HTTP caching.
- Follow the global performance tuning recommendations.
- Remove stale plugins and extensions when using a CMS.
- Add additional resources with the
upsun resources:setcommand