Downloading composer via PHP script

我的梦境 提交于 2019-12-06 09:21:49

Heres the full code to download and install:

That code does download the Composer INSTALLER, but NOT Composer itself! If you run that download, you execute the installer, which tries to download Composer. You cannot use the installer to download the Composer dependencies.

What is -d actually doing? This isn't a parameter that is in the composer documentation. My guess is that this is being interpreted as some kind of dry run flag and hence no files are actually being affected. Try changing directory in to the directory you want to executed composer from and then executing it without the -d.

e.g.:

exec('cd '.dirname(__DIR__).' && php '.$composer_path.' install', $out, $return);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!