在Codeigniter下无法正常使用共享主机cPanel cronjob [英] Not working shared hosting cPanel cronjob under Codeigniter

查看:52
本文介绍了在Codeigniter下无法正常使用共享主机cPanel cronjob的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尽管有很多主题相似的帖子,但我找不到与我在此简短描述的案例相符的人。这是测试脚本

Despite there are many posts with a similar topic, I couldn't find anyone matching my case that I briefly describe here. This is the testing script

    <?php

    if (!defined('BASEPATH')) exit('No direct script access allowed');
    require 'DashboardBase.php';

    class Hello extends CI_Controller {

            public function message($to = 'World')
            {
                    echo "Hello {$to}!".PHP_EOL;
                    print "Hello {$to}!".PHP_EOL;
                    log_message('error',"Hello {$to}!".PHP_EOL);
            }
    }

    ?>

Web服务器位于共享主机下;它用于cPanel;使用Codeigniter。

The web server is under a shared hosting; it is used cPanel; Codeigniter is used.

可以正常使用的外部URL是: https://pharmacomparison.com/adminPanel/hello/message/federico

The external URL that works properly is this: https://pharmacomparison.com/adminPanel/hello/message/federico

我已经在个人电子邮件中激活了cronjob输出通知,它可以请注意,我还将输出保存在错误日志中。

I have activated the cronjob output notification on my personal email and it can be noted that I also save the output in an error log.

这里是我的cronjob定义尝试

Here my cronjob definition attempts


  1. (由CodeIgniter建议手册):/ usr / local / bin / php public_html / adminPanel你好消息 federico->没有电子邮件通知; 错误日志中没有输出

  1. (as suggested by CodeIgniter manual): /usr/local/bin/php public_html/adminPanel hello message "federico" --> no email notification; no output in the 'error' log

进行小修改,添加了一个 /:/ usr / local / bin / php public_html / adminPanel / hello message federico->没有电子邮件通知; 错误日志中没有输出

small modification, added a "/": /usr/local/bin/php public_html/adminPanel/ hello message "federico" --> no email notification; no output in the 'error' log

(假设事先有错误,但让我们尝试)/ usr / local / bin / php public_html / adminPanel / hello消息 federico->电子邮件通知报告无法打开输入文件:public_html / adminPanel / hello; 错误日志中没有任何内容

(supposed wrong in advance, but let's try) /usr/local/bin/php public_html/adminPanel/hello message "federico" --> email notification reporting "Could not open input file: public_html/adminPanel/hello"; nothing in 'error' log

(假设事先有错误,但让我们尝试)/ usr / local / bin / php public_html / adminPanel / hello.php消息 federico->没有电子邮件通知,在错误日志中 ERROR-2020-01-10 16:09:25->找不到404页面:Hellophp /消息

(supposed wrong in advance, but let's try) /usr/local/bin/php public_html/adminPanel/hello.php message "federico" --> no email notification, in 'error' log "ERROR - 2020-01-10 16:09:25 --> 404 Page Not Found: Hellophp/message"

完整的实际磁盘路径:通知电子邮件报告不允许直接脚本访问

full real disk path: notification email reporting "No direct script access allowed"

基本上,应该被认为正确的前两次尝试都不会产生任何错误。有任何想法吗?

Basically, the first two attempts supposed correct generate nothing even no errors. Any ideas?

推荐答案

您没有正确运行它,此处是如何通过CLI在codeigniter中运行函数。

You are not running it correctly, here is how to run a function in codeigniter through CLI.

请尝试此操作

php / usr / local / bin / php public_html / adminPanel / index.php你好消息 federico

所有函数调用都必须通过index.php

All function calls must go through index.php

php /path_to_project_root/index.php ControllerName函数参数

这篇关于在Codeigniter下无法正常使用共享主机cPanel cronjob的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆