-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot run Composer binaries without path anymore #363
Comments
May you run |
Sure this works but you can imagine that this a huge hassle and slows down daily development. ;-) |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please update it if any action still required. |
Still my suggestion stands. |
I mark as request but i don't have any idea about how to manage it. If we add /var/www/html/vendor/bin and /usr/src/app/vendor/bin to the PATH, it's will depend about where the composer.json will be located. Usage of |
Fix in an unrelated project: syncthing/syncthing#8499 |
@mistraloz Not sure what you mean, Composer won't magically allow running package binaries as subcommands. So installing |
Not perfect but defined to resolve this issue with the path. And you can define your phpstan command as script part of composer.json. The alternative is to design a feature to define the PATH with an environment variable (like a PATH_EXT env who will complete the default path with a custom one). It's not a priority because it's exist another way to do it (and IMHO it's a better way). PS: I understand that is not perfect for your specific case but we try to resolve requirements for all cases. If you use multiple compose.json or if it's at another path than WORK_DIR/vendor/bin (you can customise it in composer.json), it's will not resolve anything. The feature with PATH_EXT (or another smart way) can be implemented, i'm will not work on it (at least in v4, maybe for v5) but i will merge a PR who do that. |
Well, even multiple |
@mistraloz Can you have another look at this? Since this behavior will likely not be reverted in Go, the Dockerfile.slim.apache, Dockerfile.slim.fpm-ENV PATH="$PATH:./vendor/bin:~/.composer/vendor/bin"
-RUN sed -i 's#/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin#/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:./vendor/bin:~/.composer/vendor/bin#g' /etc/sudoers
+ENV PATH="$PATH:/var/www/html/vendor/bin:~/.composer/vendor/bin"
+RUN sed -i 's#/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin#/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/var/www/html/vendor/bin:~/.composer/vendor/bin#g' /etc/sudoers Dockerfile.slim.cli-ENV PATH="$PATH:./vendor/bin:~/.composer/vendor/bin"
-RUN sed -i 's#/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin#/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:./vendor/bin:~/.composer/vendor/bin#g' /etc/sudoers
+ENV PATH="$PATH:/usr/src/app/vendor/bin:~/.composer/vendor/bin"
+RUN sed -i 's#/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin#/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/src/app/vendor/bin:~/.composer/vendor/bin#g' /etc/sudoers (Finally |
Hi @mbrodala I am sorry because i do not like said "no" but here, honestly, i cannot accept to add /var/www/html to the path, there is not very good reason to do that. I spoke with my teammate and I suggest two options that can match for you : If you do a PR to manage that in one of this way, i will review and merge it. To allow that you can change PS: And instead of |
Still thinking about this. But do you agree that the following section is pointless like this since it does not work anymore? docker-images-php/utils/Dockerfile.slim.blueprint Lines 255 to 262 in 9592740
This is the location where an absolute path must be specified instead of a relative one. |
Yes i confirm. |
Expected Behavior
Assuming a Compose service
app
using this Docker image andphpstan/phpstan
is installed via Composer, running its binaryvendor/bin/phpstan
should work without the path prefixvendor/bin
:Current Behavior
Trying to run a Composer binary without path fails:
This seems to be related to Go 1.19 which dropped support for executing commands from the current directory (a "dot path") as a security measurement. Obviously the Docker engine did upgrade to this Go version in the meantime.
This Docker image adds (among others)
vendor/bin
to the$PATH
which did allow for running Composer binaries so far but this has stopped working now:https://github.com/thecodingmachine/docker-images-php/blob/098c31b33f019fb69f45df85a14f507a4f300fb5/utils/Dockerfile.slim.blueprint#L255L262
Possible Solution
Use absolute paths in the
$PATH
, so/var/www/html/vendor/bin
and/usr/src/app/vendor/bin
instead of justvendor/bin
depending on CLI/FPM/Apache variant.Steps to Reproduce (for bugs)
exec
to run that binary just by its nameContext
Developing PHP-based apps. ;-)
Your Environment
The text was updated successfully, but these errors were encountered: