cakephp 我的蛋糕不会烤

dy1byipe  于 2022-11-11  发布在  PHP
关注(0)|答案(1)|浏览(146)

你好,我正在我的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

我已经尝试了每个版本的php在我的服务器7.0到7.2.9
有什么建议吗?

nkoocmlb

nkoocmlb1#

你不需要把php放在bin目录中cake可执行文件的前面,但是如果你想的话,你可以简单地调用cake.php文件。
将该行更改为:

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

"或者"
此外,如https://book.cakephp.org/bake/1/en/usage.html文档中所建议的
仅用途:

bin/cake bake all

希望这对你有帮助。

相关问题