Forums / Setup & design / Trying to setup cron jobs without PHP CLI

Trying to setup cron jobs without PHP CLI

Author Message

Andy Woods

Wednesday 03 August 2011 6:43:35 am

I'm hosting an ez site on a shared shared linux server. 

I need to activate the 'notifications' facility that will send an email to the site editors and administrators to notify them that new content has been added by other users.

I'm trying to add the runcronjobs.php to the list of cronjobs that will run but each time it tries to run the script I get the following error message:

  PHP is currently using the 'cgi' interface. Make sure it is using the 'cli' interface

I have searched for similar posts and come across a few entries from 5 years ago.

Can someone tell me what is the latest thinking on how I can overcome this problem please?  My ISP is not willing to configure PHP to run with the CLI.  Moving to another server is unfortunately not an option for 'political' reasons.

Thanks,

Andy

Ali Nebi

Wednesday 03 August 2011 6:58:36 am

Hi, Andy.

i found here some topics related with your problem.

 

Please check theme, maybe they will be useful for solving the problem.

 

http://share.ez.no/forums/suggestions/workaround_for_installations_without_phpcli/(from)/ez.no/

http://issues.ez.no/4027

http://issues.ez.no/3633

 

Good luck :)

Iguana Information Technologies, SL - http://www.iguanait.com

Andy Woods

Wednesday 03 August 2011 7:48:58 am

Hi Ali,

Yes - I came across all those as well - but they are from many years ago - and there were differing views as to how to solve the problem.

I've followed the steps documented in http://www.sitepoint.com/php-command-line-1-3/

ie. I included the file cli_compatibility.php at the top of the runcronjobs.php file but I still got the same error message when trying to run the runcronjobs.php script. 

 

I was wondering what the current agreed solution to the problem is...

Surely there must be a lot of other developers that have found themselves experiencing this problem during the last year or so.

Andy

Robin Muilwijk

Friday 05 August 2011 12:16:11 pm

Hi Andy,

Can you somehow schedule and call php scripts? If so, check a workaround I once used: http://share.ez.no/forums/install-configuration/ovh-and-cron-jobs.

 

Regards Robin

Board member, eZ Publish Community Project Board - Member of the share.ez.no team - Key values: Openness and Innovation.

LinkedIn: http://nl.linkedin.com/in/robinmuilwijk // Twitter: http://twitter.com/i_robin // Skype: robin.muilwijk

Andy Woods

Saturday 06 August 2011 10:07:49 am

Hi Robin,

I'm using cPanel so yes I can schedule PHP scripts to run.

I tried your workaround but I got the following when I ran the runcronjobsfrequent.php script:

Your script returned the following:
PHP Notice:  Undefined variable: argv in /home/sites/usincare.org.uk/public_html/runcronjobsfrequent.php on line 142
X-Powered-By: PHP/5.2.17
Set-Cookie: eZSESSID=hrv9k8cc9o136nnscul29hqiq5; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Content-type: text/htm
Running cronjob part 'frequent'<br/>Running cronjobs/notification.php at: 06/08/2011 6:03 pm<br/>Starting notification event processing<br/>Done<br/>Completing cronjobs/notification.php at: 06/08/2011 6:03 pm<br/>Elapsed time: 00:00:00<br/><br/>Running cronjobs/workflow.php at: 06/08/2011 6:03 pm<br/>Checking for workflow processes<br/>Status list<br/>Workflow event deferred to cron job(4): 6<br/><br/>0 out of 6 processes was finished<br/>Completing cronjobs/workflow.php at: 06/08/2011 6:03 pm<br/>Elapsed time: 00:00:00<br/>

Is there anything else I can try please?

Thanks,

Andy

Robin Muilwijk

Saturday 06 August 2011 11:05:15 am

Hi,

Although you got a notice, it looks like the script ran and did it's job. Otherwise you would not have gotton the text after the notice. Can't guarantee that for 100% though, I'm not getting that notice.

Could you copy and paste the code from that line as a reply here? My line 142 has no argv varivable.

Other than the workaround I personally don't know of other options to get cronjobs working if you do not have php running in CLI.

-- Robin

Board member, eZ Publish Community Project Board - Member of the share.ez.no team - Key values: Openness and Innovation.

LinkedIn: http://nl.linkedin.com/in/robinmuilwijk // Twitter: http://twitter.com/i_robin // Skype: robin.muilwijk

Andy Woods

Saturday 06 August 2011 11:49:54 am

Hi Robin,

 

Line 142 reads:

   for ( $i = 1; $i < count( $argv ); ++$i )

 

Andy

Robin Muilwijk

Saturday 06 August 2011 12:15:49 pm

I'll have to call for help on this one. Just checked but this is getting beyond my knowledge.

 

-- Robin

Board member, eZ Publish Community Project Board - Member of the share.ez.no team - Key values: Openness and Innovation.

LinkedIn: http://nl.linkedin.com/in/robinmuilwijk // Twitter: http://twitter.com/i_robin // Skype: robin.muilwijk

Andy Woods

Monday 08 August 2011 9:30:17 am

Hi Robin,

Has anyone been able to shed anymore light on this please?

Am I right in thinking that the following info in the cronjob notice indicates that the notification emails aren't being sent?  If so - I wonder if this will help to identify why the emails aren't being sent.

Checking for workflow processes<br/>Status list<br/>Workflow event deferred to cron job(4): 6<br/><br/>0 out of 6 processes was finished<br/>

If I goto the 'Workflow Processes' page within the Setup section of the web site's Admin area I can see the items listed.

I'd really appreciate any help you or your colleagues can give me.

Thanks,

Andy

Andy Woods

Tuesday 09 August 2011 1:03:34 am

Could the fact that I'm using PHP version 5 be responsible for the problem? I've seen a few other posts where PHP5 seems to have caused problems with sending email notifications.

Just to clarify my setup at the moment:

  1. I'm not able to use PHP CLI. 

    So - to be able to run the runcronjobs.php script I carried out the following modification:

    edited the script /kernel/classes/ezscript.php. At line 179 I commented out:
    exit( 1 );

  2. Using PHP 5
  3. Using ezPublish 4.4