1

I am trying to set up CRON jobs on cPanel v. 76.0.18 and I get "no input file specified" (NIFS), and looked into other posts (e.g., NIFS1, NIFS 2, NIFS 3, NIFS 4), not sure how to solve it.

My samples of CRON jobs:

*/10    *   *   *   *   /usr/bin/php -q /home/dir/dir/cron_dir/file-1.php
0   *   *   *   *       /usr/bin/php -q /home/dir/dir/cron_dir/file-2.php
*   *   *   *   *       /usr/bin/php -q /home/dir/dir/cron_dir/file-3.php

0   *   *   *   *       rm -rf /home/dir/dir/data_dir_1
0   0,6 *   *   *       rm -rf /home/dir/dir/data_dir_2
0   0,4 *   *   *       rm -rf /home/dir/dir/data_dir_3

How do I solve "no input file specified" error?

Thanks a million guys!

Emma
  • 27,428
  • 11
  • 44
  • 69
  • Possible duplicate of [cPanel cron job, no input file specified?](https://stackoverflow.com/questions/37678223/cpanel-cron-job-no-input-file-specified) – ficuscr Feb 06 '19 at 22:01
  • 1
    HTACCESS is not applicable as CRON runs PHP outside of Apache. For example check `$_SERVER['SERVER_ADDR']` which doesn't exist on the CLI because the webserver doesn't exist (as far as PHP is concerned) That said I would start by manually running it in the server's SHELL over SSH if you are able. This will tell you if the script can run, then once you get that worked out, you can copy the same command to Cron. Its important to SSH in using the PHP user that runs (in Cpanel it's typically the Cpanel user) – ArtisticPhoenix Feb 06 '19 at 22:37
  • 1
    One thing that may be happening is the files may have been uploaded by root (or another user), in which case the C-Panel user may not have permission to run those file. If you are 100% sure the path is correct, then this is the most likely reason. To be clear, that is why I said this above `Its important to SSH in using the PHP user that runs [CRON]` – ArtisticPhoenix Feb 06 '19 at 22:44
  • 1
    It's also important to know that the CLI (or CRON in this case) can use a different `php.ini` file from the server. Typically I have seen this named `cli-php.ini` so if you have any settings such as TimeZone in there, make sure you realize this. – ArtisticPhoenix Feb 06 '19 at 22:49
  • 1
    I would almost put money on it being permissions. Another thing is casing, Linux is case sensitive. I once spent 5 hours trying to load an image `image.JPG` with `image.jpg`.... – ArtisticPhoenix Feb 06 '19 at 22:58
  • 1
    Hi Emma! I've run into several of your suggested edits in the Suggested Edits Queue and I've noticed that your edit comment is always a slight variation of "just improving the question ". I would encourage you to write more descriptive edit comments. (Focus on *how* you are making the question better). I appreciate your efforts to help the community through edits! – GBlodgett Mar 07 '19 at 23:48

1 Answers1

0

If the command executes correctly in CLI directly, you might try putting it in a .bash file and referencing that in cron. I've seen weird issues with commands in cron, and sometimes wrapping it in a script can help.

If it /doesn't/ execute correctly in CLI, then you might start there :p

AlexanderESmith
  • 194
  • 2
  • 4