• Plesk Uservoice will be deprecated by October. Moving forward, all product feature requests and improvement suggestions will be managed through our new platform Plesk Productboard.
    To continue sharing your ideas and feedback, please visit features.plesk.com

php cronjobs for clients

E

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?
 
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

mysql.so
gd.so

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

;extension=mysql.so
;extension=gd.so

I get failures of dublicated names... :(

So whats wrong?

Any ideas?
 
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
 
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...
 
Back
Top