You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello Shivam,
I love your work on setup-php and I rely on it every day! Please take this as a nice-to-have feature requests and nothing urgent. I'm also willing to sponsor the implementation.
I noticed that on GitHub-owner runners (ubuntu-latest etc.) the action setup-php takes just a few seconds. Not sure how is that achieved.
I notcied that on Blacksmith (https://www.blacksmith.sh/) which I recently started using for some things, it always takes over a minute. Also not sure why that is. I'm testing it on runs-on: "blacksmith-2vcpu-ubuntu-2404" and runs-on: "blacksmith-4vcpu-ubuntu-2404"
Do you think it could be optimized?
Thank you!
Please check the latest release
I have checked releases, and the feature is missing in the latest patch version of v2.
On GitHub runners the libraries that are pre-installed are known and change rarely, so we have cached builds with libraries that are not there, so it is as simple as downloading a build and extracting it.
On self-hosted / third party runners it installs the missing libraries using apt and that adds to the runtime. Supporting cache for different self-hosted runner providers is something I have considered, but the added maintenance burden is not something I can take up right now.
I'm not sure if there is an easy way to do this in the workflow without implementing a script that installs the same packages as setup-php and caching them. There might be some actions that cache apt packages that might help.
I did some analysis and also talked with their support: they use images mirroring the github runners, but this isn't detected.
I created #1069 to discuss a potential change how they are detected, though I need more eyes on this so we don't break other cases I'm not aware of.
Their support basically confirmed this and the real solution is indeed to provide a custom AMI image but with this slight change in detection, I was already able to cut down time in half, which for me is "good enough ™️" win for now.
It allows users of the action to specifically tell the action the runner is "GitHub". It does still log the warning so when it fails the logs give you a clear indication of what could be causing it. It's a flag that you won't set to github by accident so it feels kind of safe to support it this way.
The default stays safe, assume the cached builds don't work on self-hosted runners. But still allow for an explicit opt-in shortcut with significantly improved performance gains.
@bram-rongen That would leave self-hosted runners that do not have all the libraries that PHP needs broken as our GitHub builds only have a minimal set of libraries that are missing on GitHub runners.
This is experimental as it uses the same cached builds we have for GitHub runners and resolves any dependency issues at the end, but that should be much faster than the default of installing all dependencies.
Let me know if you face any issues.
Reacted by Metin Bektas, Ian Fortier, Bram Rongen, Jack Bayliss and Aziz
Activity
shivammathur commentedon Jan 29, 2026
On GitHub runners the libraries that are pre-installed are known and change rarely, so we have cached builds with libraries that are not there, so it is as simple as downloading a build and extracting it.
On self-hosted / third party runners it installs the missing libraries using apt and that adds to the runtime. Supporting cache for different self-hosted runner providers is something I have considered, but the added maintenance burden is not something I can take up right now.
ondrejmirtes commentedon Jan 29, 2026
Thank you for letting me know! Is there something I could do in the workflow yml file to cache these things myself before calling setup-php?
shivammathur commentedon Jan 29, 2026
I'm not sure if there is an easy way to do this in the workflow without implementing a script that installs the same packages as setup-php and caching them. There might be some actions that cache apt packages that might help.
jbcr commentedon Feb 25, 2026
I had a similar situation with a self-hosted runner and the php/php-setup-sdk action. I forked the action to add support for a local cache folder.
Can we use a custom Docker image in Blacksmith runner? Make the image with all necessary libraries.
mfn commentedon Mar 19, 2026
I've the same problem using depot.dev
I did some analysis and also talked with their support: they use images mirroring the github runners, but this isn't detected.
I created #1069 to discuss a potential change how they are detected, though I need more eyes on this so we don't break other cases I'm not aware of.
Their support basically confirmed this and the real solution is indeed to provide a custom AMI image but with this slight change in detection, I was already able to cut down time in half, which for me is "good enough ™️" win for now.
WDYT?
sebastiaanluca commentedon May 6, 2026
shivammathur commentedon May 6, 2026
sebastiaanluca commentedon May 6, 2026
shivammathur commentedon May 6, 2026
bram-rongen commentedon Jun 1, 2026
I personally opted for this "fix": main...bram-rongen:setup-php:main
It allows users of the action to specifically tell the action the runner is "GitHub". It does still log the warning so when it fails the logs give you a clear indication of what could be causing it. It's a flag that you won't set to github by accident so it feels kind of safe to support it this way.
The default stays safe, assume the cached builds don't work on self-hosted runners. But still allow for an explicit opt-in shortcut with significantly improved performance gains.
Would you be open to a PR?
shivammathur commentedon Jun 2, 2026
@bram-rongen That would leave self-hosted runners that do not have all the libraries that PHP needs broken as our GitHub builds only have a minimal set of libraries that are missing on GitHub runners.
shivammathur commentedon Jun 2, 2026
I have plans to work on builds that can be used on third-party runners and installed quickly, but no promises on the timeline yet.
shivammathur commentedon Oct 8, 2026
@ondrejmirtes @bram-rongen @mfn
With the new 2.40.0 release, we have experimental support for builds cache on Blacksmith and depot.dev runners. Please try and provide feedback.
This is an opt-in feature on these runners, you can specify
use_builds_cacheenvironment variable.This is experimental as it uses the same cached builds we have for GitHub runners and resolves any dependency issues at the end, but that should be much faster than the default of installing all dependencies.
Let me know if you face any issues.
ondrejmirtes commentedon Oct 8, 2026
@shivammathur Yes, works great for me, thank you 😊