我的蛋糕不会烤

时间:2018-08-28 21:34:21

标签: php cakephp command-line-interface

嗨,我正在尝试在ubuntu服务器上运行bake cmd,但未按我期望的方式处理。

我运行以下

/opt/plesk/php/7.0/bin/php bin/cake bake all

我希望它能为相关表创建模型,控制器和视图,但我却能得到

在此处输入代码

# Canonicalize by following every symlink of the given name recursively
canonicalize() {
    NAME="$1"
    if [ -f "$NAME" ]
    then
        DIR=$(dirname -- "$NAME")
        NAME=$(cd -P "$DIR" > /dev/null && pwd -P)/$(basename -- "$NAME")
    fi
    while [ -h "$NAME" ]; do
        DIR=$(dirname -- "$NAME")
        SYM=$(readlink "$NAME")
        NAME=$(cd "$DIR" > /dev/null && cd $(dirname -- "$SYM") > /dev/null && p                 wd)/$(basename -- "$SYM")
    done
    echo "$NAME"
}

# Find a CLI version of PHP
findCliPhp() {
    for TESTEXEC in php php-cli /usr/local/bin/php
    do
        SAPI=`echo "cli" | $TESTEXEC 2>/dev/null`
        if [ "$SAPI" = "cli" ]
        then
            echo $TESTEXEC
            return
        fi
    done
    echo "Failed to find a CLI version of PHP; falling back to system standard p                 hp executable" >&2
    echo "php";
}

CONSOLE=$(dirname -- "$(canonicalize "$0")")
APP=$(dirname "$CONSOLE")

# If your CLI PHP is somewhere that this doesn't find, you can define a PHP envi                 ronment
# variable with the correct path in it.
if [ -z "$PHP" ]
then
    PHP=$(findCliPhp)
fi

if [ $(basename $0) != 'cake' ]
then
    exec $PHP "$CONSOLE"/cake.php $(basename $0) "$@"
else
    exec $PHP "$CONSOLE"/cake.php "$@"
fi

exit

我已经在服务器7.0到7.2.9上尝试了每个版本的php

有什么建议吗?

1 个答案:

答案 0 :(得分:3)

您不需要将php放在bin目录中的cake可执行文件的前面,但是如果您愿意,您可以简单地调用cake.php文件。

将该行更改为: /opt/plesk/php/7.0/bin/php bin/cake.php bake all

此外,如@ book.cakephp.org / 3.0 / en / bake / usage.html文档中所建议,仅使用: bin/cake bake all

希望这会有所帮助。