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

php cronjobs for clients

Discussion in 'Plesk for Linux - 8.x and Older' started by Effektor, Aug 3, 2006.

  1. Effektor

    Effektor Guest

    Hey ppl,

    I'm not able to solve following problem.

    If I add a cronjob as root for example:

    */15 * * * * /usr/bin/php /home/www/vhosts/DOMAIN/httpdocs/script.php

    anything is ok.

    If I add a cronjob as a normal user which was added by using Plesk for example the user of DOMAIN:

    */15 * * * * /usr/bin/php /home/www/vhosts/DOMAIN/httpdocs/script.php

    I get back an error like:

    Fatal error: Call to undefined function: mysql_connect() in /home/www/vhosts/DOMAIN/httpdocs/inc/mysql.inc.php on line 22

    I already test it directly at the shell anything is ok.
    I added #! /usr/bin/php in each script, doesn't solve the problem.
    I added -f at the cronjob, doesn't solve the problem.

    Anyone can tell me whats wrong?
  2. Effektor

    Effektor Guest

    New Information:

    I logged in as root and used

    SERVER:/# php4 -i
    there are several information for example:

    Configuration File (php.ini) Path => /etc/php4/cli/php.ini

    Than I logged in as a normal user added by Plesk

    SERVER:/# php4 -i
    there are several information for example:

    Configuration File (php.ini) Path => /etc/php4/cli


    doesn't seem to be implemented.

    if i add the arg --with-config-file-path=/etc/php4/cli/php.ini
    the server should use the same config as it does while using the root user.
    Instead of doing so he uses the /etc/php4/cli.

    If I manualy uncomment the two lines


    I get failures of dublicated names... :(

    So whats wrong?

    Any ideas?
  3. dtbaker

    dtbaker Basic Pleskian

    Mar 31, 2005
    Likes Received:
    I am having the same issue here.

    After migrating plesk date from 7 to 8.

    PHP files executed as root cron jobs defined in the 'Server > Cron' section of Plesk 8 work fine.

    PHP files executed under a clients domain do not work. They seem to run with different php configurations.

    I get failure mysql_connect function undefined.

    If i run this as root from the command line it works fine:
    php /var/www/vhosts/website.com.au/httpdocs/cron/testcron.php

    If i run the same script in cron on a client it fails. if i run teh cron under server root it works.

    im a rush.. hope that makes sense

    anyone have any ideas?

    ive tried modifying the cli php.ini file, also tried modifying the mysql.so module paths
  4. Effektor

    Effektor Guest

    Fixed the Prob...

    changed the Permission of /etc/php.ini to 644 before nobody else than root had the permission to read out the file...

    Now it works...