Meet PHP standalone - just what your crons need

IgorL posted 1st of February 2010 in Community Voice. 2 comments.

Some of you may already have noticed that setting PHP parameters to the correct states does not always help. Sometimes you keep on getting emails like "register_globals is On", "XSL is missing" and so on. This is actually because cron jobs use a different PHP version, which is usually referred to as CLI (command-line interpreter), I call it PHP standalone. This PHP version is not used by your web server that's why it can't inherit those settings that you set for PHP running as an Apache module or CGI (common gateway interface).

This version has to have its own extensions installed (XSL, GD library, etc.) and its own settings set. While extensions can only be installed by system administrators (that's where you should address such problems like "XSL not installed"), you still can change the settings which are required by Dolphin. And it doesn't matter now whether your regular PHP is connected to Apache as a module or CGI.

You need to create a file with PHP settings in php.ini type, that is setting=value, for example:
register_globals=Off
short_open_tag=On
memory_limit=128M

etc.

You need to save this file with any name and any extension, but I'd suggest you to save it as php.ini to avoid confusion and save it to your home directory outside the website folder, for example in /home/user/

Then you need to modify your cron command used by Dolphin in this way:
* * * * * cd /home/user/www/periodic; /usr/local/bin/php -c /home/user/php.ini -f /home/user/www/periodic/cron.php

The parameter -c specifies the path to PHP settings file, the parameter -f specifies that PHP commands will be taken from the file following after it. /usr/local/bin/php is the php executable location on most UNIX systems. This location may be different in your case, so clarify this with your hosting provider.

Well, this should be enough to make your crons run smoothly.

 
Comments
·Oldest
·Top
Please login to post a comment.
francescocarni
because your response times are slow? if a user has problems as it must do to fix this?
deaftv
many thanks!! cron jobs Plesk 10.4.4

* * * * * cd /var/www/vhosts/domain/httpdocs/periodic; /usr/local/bin/php -c /etc/php5/apache2/php.ini -f /var/www/vhosts/domain/httpdocs/periodic/cron.php
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.
PET:0.061486959457397