当前位置: 动力学知识库 > 问答 > 编程问答 >

php - Troubleshoot Codeigniter CLI stopped

问题描述:

I have been using the CLI interface to send out cron jobs from my codeigniter page. It worked fine until I updated Wordpress yesterday. I do not know how this effected Codeigniter but that is when the trouble started. I also installed cURL at about the same time. I am not sure if that could have made a difference.

SYMPTOMS:

None of my codeigniter CLI scripts work. I have two scripts that send out email reminders, and another that synchronizes my database and none function.

ERRORS:

I had some errors come up when I tried to run my scripts such as:

Use of undefined constant __DIR__ - assumed '__DIR__'

This was never a problem before. But for now I change that to

dirname(__FILE__)

and that seemed to help. At least that error stopped.

Next another error notice appeared regarding code in my scripts that I was not getting before: "Can't use method return value in write context in . . ."

This error was in reference to this line of code:

if (!empty($this->get_available_hours($date, $provider_id))) {

I modified this to

$availabehours=$this->get_available_hours($date, $provider_id);

if (!empty($availabehours)) {

And the error stopped. But the script usually sends out email regarding availability and no email is sent.

Now I have no errors. I run the scripts and I get no results. If I purposefully mess with the code and do things wrong, I get the appropriate error messages. So, at some level it is reading the file.

I tried just running a simple "hello world file" as discribed here

https://ellislab.com/codeigniter/user-guide/general/cli.html

And nothing was returned.

I tried a simple email script that would send out an email without accessing my database and it did not send anything to me.

It appeares to me like something has caused my code to be interpreted in an older version of php. So I looked at the version currently running:

When logged into the terminal in PuTTY I get:

PHP 5.2.17 (cli) (built: Feb 23 2012 10:42:34)

Copyright (c) 1997-2010 The PHP Group

Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies

Out of date ...

But when I look in the terminal within WinSCP I get:

PHP 5.5.28 (cli) (built: Sep 4 2015 12:07:49)

Copyright (c) 1997-2015 The PHP Group

Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies

with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies

This looks up to date.

Running this works: php -r 'echo "Hello World!\n";'

MY QUESTIONS:

1) What tests can I run to find out what is blocking things with my CLI?

Any tips would be appreciated.

2) Why am I seeing two different versions of PHP depending on the terminal I am running and could this be the cause of my problem?

分享给朋友:
您可能感兴趣的文章:
随机阅读: