• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

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