在shell脚本中运行时,Composer安装错误

时间:2016-07-13 12:02:45

标签: php shell laravel composer-php

我有shell脚本,在应用程序启动之前执行。 这是shell脚本

#!/bin/sh
/usr/local/bin/composer install
/usr/local/bin/php artisan optimize
/usr/local/bin/php artisan key:generate

当我尝试执行此脚本时,我收到此错误

Running composer as root/super user is highly discouraged as packages, plugins and scripts cannot always be trusted


[Symfony\Component\Console\Exception\CommandNotFoundException]
 " is not defined.
 Did you mean this?
   install

安装了composer可执行文件,并且在从命令行调用时可以正常工作

1 个答案:

答案 0 :(得分:0)

诀窍是把它像这样

#!/bin/sh
`/usr/local/bin/composer install`
`/usr/local/bin/php artisan optimize`
`/usr/local/bin/php artisan key:generate`