0

我已经通过使用 putty 连接到我的站点来测试 shell 脚本,但我必须:

cd /home/username/bin //which is where my cake console is located

然后我可以运行命令,它是:

cake email second_user

使用文档中描述的方式,我无法让它工作,您只需 cd 进入根文件夹并运行命令 bin/cake email second_user。

如果我以这种方式尝试,我会收到此错误:

Failed loading /usr/php/56/usr/lib64/php/modules/ZendGuardLoader.so:  /usr/php/56/usr/lib64/php/modules/ZendGuardLoader.so: undefined symbol: zend_new_interned_string
Failed loading /usr/php/56/usr/lib64/php/modules/opcache.so:  /usr/php/56/usr/lib64/php/modules/opcache.so: undefined symbol: zend_new_interned_string
Status: 500 Internal Server Error
Content-type: text/html

这也是我尝试使用 bluehost 设置 cron 作业时遇到的相同错误。

Cakephp 3文档说要使用:

cd /full/path/to/root && bin/cake myshell myparam

我试过使用这种类型的命令无济于事。

然后,我尝试使用 cron 作业来解决版本问题,我只使用实际的 bin 位置来运行 cake,如下所示:

php-cgi -c /home/username/public_html/php.ini /home/username/bin/cake email second_user > /home/username/logs/cron_logs.txt 2>&1

但是我在我的日志文件中得到了这个(它也有与上面相同的错误):

Failed loading /usr/php/56/usr/lib64/php/modules/ZendGuardLoader.so:  /usr/php/56/usr/lib64/php/modules/ZendGuardLoader.so: undefined symbol: zend_new_interned_string
Failed loading /usr/php/56/usr/lib64/php/modules/opcache.so:  /usr/php/56/usr/lib64/php/modules/opcache.so: undefined symbol: zend_new_interned_string
################################################################################
#
# Cake is a shell script for invoking CakePHP shell commands
#
# CakePHP(tm) :  Rapid Development Framework (http://cakephp.org)
# Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
#
# Licensed under The MIT License
# For full copyright and license information, please see the LICENSE.txt
# Redistributions of files must retain the above copyright notice.
#
# @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
# @link          http://cakephp.org CakePHP(tm) Project
# @since         1.2.0
# @license       http://www.opensource.org/licenses/mit-license.php MIT License
#
################################################################################

# 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 && pwd)/$(basename -- "$SYM")
    done
    echo "$NAME"
}

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

exec php "$CONSOLE"/cake.php "$@"
exit

如果我使用 cake.php(或任何其他命令)而不仅仅是 cake,我只会收到加载失败的错误。

register_argc_argv 也被打开。

有人可以帮忙吗?

4

1 回答 1

0

我不确定这是否可以做到。由于 bluehost 上的 php 5.6 更像是一个 beta 测试,所以我无法让它工作。我不得不切换到 php 5.4,然后我才能让 cron 工作正常工作。

于 2016-06-03T17:40:07.253 回答