Menu

(newbie) Cron job problem : php file

Webmin
Popop
2008-02-12
2013-05-21
  • Popop

    Popop - 2008-02-12

    Hi all,

    I'm a new user of Webmin, and I don't get it with cron jobs.
    What I'd like to do seems quite simple : I want a PHP file to be executed every day.

    Using the cron job module, I created a new task, with the parameters below :

    executed as : root
    command : /var/www/my_directory/my_file.php

    This doesn't work, I guess I need to tell Webmin that the file needs to be executed as an Apache user, or something.
    I thought it would be easier doing it with Webmin, instead of the console !!!

    Please also note that I set the file's attributes to 755.

    Any advice, please ?

    Popop ./.

     
    • rj elleray

      rj elleray - 2008-02-12

      try adding a simple word to tell the os what to do with your file..

      (unlike a gui you need to tell the command processor which application software has to use that file)

      command :  php /var/www/my_directory/my_file.php

      d.

      ps i have always found it best to try the command line for a cron in a command line first and i am no linux guru at all :)
      (there is a command line module to do this if you cannot ssh in)

       
    • Popop

      Popop - 2008-02-12

      Hi delleray, thanks a lot for your (quick) answer.

      Just tried it, ang got this error message :

      /bin/sh: php: command not found

      Of course I can confirm that PHP is really installed on the server, my website is running right now !

      I tried to replace "php" with "php5", doesn't change anything...

      You're right, I should try and learn how to do it with the command line first !

       
      • rj elleray

        rj elleray - 2008-02-12

        no probs
        just replace the single word
        php
        with /usr/bin/php  OR wherever your php binary is installed

        to find it type  whereis php
        and you will get something like php: /usr/bin/php /etc/php.d /etc/php.ini /usr/lib/php...

        Your root environment hasn't got the php path in its default set of paths wher it looks for commands...

        d.

         

Log in to post a comment.

MongoDB Logo MongoDB