1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice
  2. Dear Pleskians, please read this carefully! New attachments and other rules Thank you!
    Dismiss Notice
  3. Dear Pleskians, I really hope that you will share your opinion in this Special topic for chatter about Plesk in the Clouds. Thank you!
    Dismiss Notice

User account can't run cron?

Discussion in 'Plesk for Linux - 8.x and Older' started by JDub@, Mar 15, 2006.

  1. JDub@

    JDub@ Guest

    0
     
    Hi,

    I'm having some trouble running a cron script as a user within Plesk 7.5.4. The target file is being found fine, but I'm unable to access PHP in order to run it.

    Upon running the following command: -

    /usr/local/psa/admin/bin/php /var/www/vhosts/domain/httpdocs/tasks_minute.php5

    I get the following error in the email sent to me: -

    /bin/sh: /usr/local/psa/admin/bin/php: Permission denied

    Server cron runs fine, but then they run as root!

    Why is this? Am I pointing to the wrong PHP, or should I run this as a server cron? I don't really want to, as it only applies to a specific domain.

    Any help on this would be MUCH appreciated!!

    Regards

    Jules.
     
  2. serve-you.net

    serve-you.net Guest

    0
     
    Wrong PHP. It's a pretty safe assumption that anything user related will not be under /usr/local/psa/admin

    Try 'which php' to find the "real" version of PHP. Also, you will probably need the -f flag in your command.
     
  3. JDub@

    JDub@ Guest

    0
     
    Many thanks for the feedback - Quick Q's: -

    Where do I search for 'which php'?
    Also what syntax is the -f flag entered - i.e. where in the command string?

    Regards

    Jules.
     
  4. serve-you.net

    serve-you.net Guest

    0
     
    just type the following in a shell (SSH):
    which php

    The -f flag is a php flag, so it would go after php, and before the file name. For example:

    php -f /var/www/vhosts/domain/httpdocs/tasks_minute.php5
     
  5. JDub@

    JDub@ Guest

    0
     
    Many thanks for your help there - I haven't solved the problem yet, but I'm a few steps closer!! :)

    Out of curiosity, what does the -f flag do?

    Regards

    Jules.
     
  6. serve-you.net

    serve-you.net Guest

    0
     
    root@ns ~>php -h
    Usage: php [-q] [-h] [-s] [-v] [-i] [-f <file>]
    php <file> [args...]
    -a Run interactively
    -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>.
     
  7. jest3r_fbsd

    jest3r_fbsd Guest

    0
     
  8. DXTrim

    DXTrim Guest

    0
     
    Hello,

    Try on the crom command:

    /usr/bin/php /home/httpd/vhosts/domain/httpdocs/path/file.php >/dev/null

    and check that your php file starts with:

    #!/usr/local/bin/php -q

    Hope this helps.

    Cheers,

    DXTrim
     
  9. JDub@

    JDub@ Guest

    0
     
    Many thanks for the input folks. My developer managed to suss it out with the input of the poster above - It took a little more shuffling around, but this was the final command that appears to the job: -

    (pushd '/var/www/vhosts/domain/httpdocs'; /usr/bin/php -e -f tasks_minute.php5; popd)

    Cheers

    J>
     
Loading...