Support is online

Cron Job #7973

Open liedtke,k opened this topic Monday, 18 January 2016 · 32 replies
Author

Hi Roland,

I try to set a cron-job.
This is my string:

/bin/php ./administrator/components/com_csvi/helper/cron.php --key=’mysecretword’ --template_name=’Import_Artikel’

This is the protocol:

Status: 404 Not Found
X-Powered-By: PHP/5.3.29
Content-type: text/html

No input file specified.

In the template under source is the importfile defined. The manuel Import works fine.

What is wrong ?

Thanks for help.

Support

Hello Klaus,

The PHP version is too low, you need to have at least PHP 5.4. The message "No input file specified" comes from PHP that it can't find the cron.php file. So you will need to check the correct location of the file.

Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Author

Hi Roland,

no it's 5.6
Same result:
Status: 404 Not Found
X-Powered-By: PHP/5.6.17
Content-type: text/html

No input file specified.

Support

Hello,
Can you try setting the full path of the file in the cron command? Please follow the instructions under "Build the cron command in Setting up Cron job documentation.

Kind regards,

Tharuna

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Support

Klaus,

no it's 5.6

In your first post it was 5.3.29 :)

As I mentioned before, the error is from PHP saying it can't find the cron.php file.

Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Author

Sorry wrong posting.
Now i tried the full string:

/bin/php -f ./administrator/components/com_csvi/helper/cron.php --key=mysecretword --template_name=Import_Artikel --file=./transfer/ftpa2p.csv

and thats the result:

Usage: php56 [-q] [-h] [-s] [-v] [-i] [-f <file>]
php56 <file> [args...]
-a Run interactively
-b address:port|<port> Bind Path for external FASTCGI Server mode
-C Do not chdir to the script's directory
-c <path>|<file> Look for php.ini file in this directory
-n No php.ini file will be used
-d foo[=bar] Define INI entry foo with value 'bar'
-e Generate extended information for debugger/profiler
-f <file> Parse <file>. Implies `-q'
-h This help
-i PHP information
-l Syntax check only (lint)
-m Show compiled in modules
-q Quiet-mode. Suppress HTTP Header output.
-s Display colour syntax highlighted source.
-v Version number
-w Display source with stripped comments and whitespace.
-z <file> Load Zend extension <file>.
-T <count> Measure execution time of script repeated <count> times.
Error in argument 3, char 2: no argument for option -

Support

Hello Klaus,

Error in argument 3, char 2: no argument for option -

This error has been discussed before in this thread.

This is an issue with the server setup as it doesn't properly handle the passing of the double dashes. You can find quite a few such posts on Google if you look for the error you get.

One suggestion I found was to use php5-cli or the other option you could try is what is posted in this Joomla! forum topic.

Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Author

Just changed the string. Folder was missing.
Now this message:
X-Powered-By: PHP/5.6.17
Set-Cookie: 26f232c7020f95436630efe511962dbb=0k0sn5rlb0a31bdg8mlavrg7v5; path=/; HttpOnly
Content-type: text/html

no error, but import was not running.

Support

There is no error but it nothing is happening. At a minimum I would expect to see this output:

Use --help to see the help information
Processing started...

It looks like the script is not being triggered at all. You can try to run it with the option --help to see if you get any output.

Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Author

Hi Roland,

with /h:

Usage: php56 [-q] [-h] [-s] [-v] [-i] [-f <file>]
php56 <file> [args...]
-a Run interactively
-b address:port|<port> Bind Path for external FASTCGI Server mode
-C Do not chdir to the script's directory
-c <path>|<file> Look for php.ini file in this directory
-n No php.ini file will be used
-d foo[=bar] Define INI entry foo with value 'bar'
-e Generate extended information for debugger/profiler
-f <file> Parse <file>. Implies `-q'
-h This help
-i PHP information
-l Syntax check only (lint)
-m Show compiled in modules
-q Quiet-mode. Suppress HTTP Header output.
-s Display colour syntax highlighted source.
-v Version number
-w Display source with stripped comments and whitespace.
-z <file> Load Zend extension <file>.
-T <count> Measure execution time of script repeated <count> times.

Support

Hello Klaus,

The /h is something else than --help. The /h is for PHP and the --help is for CSVI. So your command should look something like

/bin/php -f ./administrator/components/com_csvi/helper/cron.php --help

One thing I wonder if the /bin/php is correct and shouldn't be /usr/local/bin/php That seems to be the most used PHP location.

Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Author

Hi Roland,

i tried this string:
/usr/local/bin/php ./NEU/administrator/components/com_csvi/helper/cron.php --help --key='mysecretword' --template_name='Import_Artikel'

Result:
X-Powered-By: PHP/5.6.17
Set-Cookie: 26f232c7020f95436630efe511962dbb=ruqneg5ssmbkphamatifn2asq3; path=/; HttpOnly
Content-type: text/html

Support

Hello Klaus,

The key and template name are not needed with the help key. However it makes no difference the script doesn't get started because the help text is not shown.

Try this:

/usr/local/bin/php ./NEU/administrator/components/com_csvi/helper/cron.php -- --help

see if that outputs the help text.

Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Author

same:
X-Powered-By: PHP/5.6.17
Set-Cookie: 26f232c7020f95436630efe511962dbb=fuomch1copjki2q8p43p2n9ks7; path=/; HttpOnly
Content-type: text/html

Support

I am out of ideas as to what is wrong with your server setup. It may be good to ask your hosting provider as to how to use command line arguments on their servers.

Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Author

Hi Roland,
So i asked Hoster.
They said: Make sure that the script is corect. The message:
Set-Cookie: 26f232c7020f95436630efe511962dbb=uqcpisht2i3f39krapejs5iij1; path=/; HttpOnly
is the problem. This is only in http allowed. Your chrone.php must be wrong.
Regards
Klaus

Support

Hello Klaus,

So I have been able to reproduce this issue. The issue has to do with the used PHP instance in the terminal.

The working version:

/usr/local/bin/php -v

PHP 5.3.29 (cli) (built: Jun 1 2015 10:21:13)

The non-working version:

php -v

PHP 5.3.29 (cgi-fcgi) (built: Jun 1 2015 10:21:12)

Notice the difference between cli and cgi-fcgi. You must be using the cli version, the cgi-fcgi version will return the message.

This has nothing to do with the CSVI script but has everything to do with the PHP used.

Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Author

Hi Roland,
Thats the answer when i trie this:/usr/local/bin/php -v
PHP 5.6.17 (cgi-fcgi) (built: Jan 15 2016 12:39:55) Copyright (c) 1997-2015 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies

Regards

Support

Hello Klaus,

So you can see that is the wrong PHP executable. You need to have the one that says cli (command line interface).

Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Author

How i can change this?

Support

You can't change the executable, that is how the server is setup. The hosting provider should be able to tell you where the cli version of PHP is located, so you can use that.

Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Author

they say the don't have a cli version.

Support

they say the don't have a cli version.

:blink:

That means you can't run a cron job then with them. You can see this is not a CSVI only issue, by running PHP with one of the Joomla provided CLI scripts.

If you run

php cli/finder_indexer.php

it returns

Content-type: text/html

This is a command line only application.

Another one you can see as well is the deletefiles.php script. It will just return the HTML message as you see with CSVI.

Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Author

answer:
Status: 404 Not Found
X-Powered-By: PHP/5.6.17
Content-type: text/html

No input file specified.

Support

That is PHP telling you that no filename has been given. This is the CLI version of PHP?

Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Author

if i enter this:
php cli/finder_indexer.php
Answer:
Status: 404 Not Found
X-Powered-By: PHP/5.6.17
Content-type: text/html
No input file specified.

They don't have a CLI-Version.
Asked other Host-Providers.
Nobody has an CLI executeable.
Regards
Klaus

Support

Hello Klaus,

Nobody has an CLI executeable.

That is not true. The CLI I showed you is from SiteGround, so I guess you didn't ask them. Many people run cron jobs without a problem.

As you can see, you can't even run the Joomla CLI scripts either.

I was thinking something else. PHP itself comes with both the CLI and CGI versions. Shouldn't it be somewhere on the server?

Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Support

Klaus,

I am rewriting the cron script so it can be used on a server like yours. Once it is done, I will let you know.

Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Author

u are my hero

Support

Klaus,

Attached is the patch for the cron, you can load the patch file via the maintenance menu. After that see if you can run the cron command.

Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Author

Hi Roland,

Here the answer:
Processing started...
Template Import_Artikel
Fatal error: Call to undefined method CsviHelperTemplate::getEnabled() in /mnt/webm/d3/31/52727531/htdocs/NEU/administrator/components/com_csvi/helper/cron.php on line 366 PHP Fatal error: Call to undefined method CsviHelperTemplate::getEnabled() in /mnt/webm/d3/31/52727531/htdocs/NEU/administrator/components/com_csvi/helper/cron.php on line 366

Support

Hello Klaus,

It seems to show a sign of life. The error is because I sent you the cron file for the upcoming CSVI 6.5.0. Attached is the altered one for your version.

Kind regards,

RolandD

=========================
If you use our extensions, please post a rating and a review at the Joomla! Extension Directory

Author

Hi Roland,
I can't believe it.
Use --help to see the help information
Processing started...
Template Import_Artikel
Import has finished

Thank you so much for your great support.

Regards

Log in to reply to this topic.