Trying run a php script from cron

Nerius Landys nlandys at gmail.com
Tue Mar 9 18:18:14 UTC 2010


> I am trying to run a php script from the cron tab and these are the errors I
> receive:
>
>
> /usr/local/bin/php php -q /home/xxxx/ripper.php result
> Could not open input file: php
> /usr/local/bin/php php -/home/xxxx/ripper.php result
>
> Could not open input file: php
>
> /usr/local/bin/php  -/home/xxxx/ripper.php result
>
> This script must be called from the command line.
>
> Running Freebsd 8.0,  Php 5.2.12
> I have chmod the script 644 still no luck tried it chmod 777 still no luck.
> I have goggled this problem and followed the tutorials but still no luck.
> Any ideas how I can get the script to run?
> I can run run it from the command line without any problems.

Instead of
  /usr/local/bin/php php -q /home/xxxx/ripper.php
try
  /usr/local/bin/php -f /home/xxxx/ripper.php
or just
  /usr/local/bin/php /home/xxxx/ripper.php

You can also try a script like this one:

  #!/usr/local/bin/php -f
  <?php
  echo "foo\n";
  ?>

And running it like this:
  /home/xxxx/ripper.php
after chmod'ing it to be executable.


More information about the freebsd-questions mailing list