简体   繁体   English

Composer.phar 不想由 PHP 脚本中的 shell_exec 运行。 为什么?

[英]Composer.phar don't want to run by shell_exec from PHP script. Why?

Trying to execute it with all possible params, such as -d and full path etc.. No errors.尝试使用所有可能的参数执行它,例如 -d 和完整路径等。没有错误。 When running another commands, all is ok, when running composer from CMD, all is ok too.运行另一个命令时,一切正常,从 CMD 运行 composer 时,一切正常。 Have tried exec, system, shell_exec etc.. What it could be?尝试过 exec、system、shell_exec 等。它可能是什么?

echo system('php composer.phar install'); echo system('php composer.phar install');

Try outputting the error stream as well:也尝试输出错误流:

system('php composer.phar install 2>&1');

It might give you more of a hint as to what is going wrong.它可能会给你更多关于出了什么问题的提示。

Try this尝试这个

$path = 'path where, composer.phar and composer.json exists';

var_dump(shell_exec("
  cd $path;
  export COMPOSER_HOME=$path./.config/composer;
  php $path/composer.phar show -i 2>&1"));

Tested on Linux.在 Linux 上测试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM