Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6902229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:46:19+00:00 2026-05-27T07:46:19+00:00

I have a zendframework project for which i need to run a script periodically

  • 0

I have a zendframework project for which i need to run a script periodically to upload the content of a folder and another do download. The script itself is ready but I am struggling to figure out where or how to set up the script to run. I have tried lynx and curl so far. I first had an error about specified controller being wrong and i fixed that but now I just get a blank screen when I run the script but file(s) are not uploaded.

For a zendframework project how do I setup script to be run by cron?

EDIT:
My project structure looks like this:

mydomain.com

    application
    library
    logs
    public
        index.php
    scripts
        cronjob.php
    tests

cronjob.php is the script i need to run. The first few lines of which are:

<?php
define("_CRONJOB_",true);
require('/var/www/remotedomain.info/public/index.php');

I also modified my index.php file like below:

// Create application, bootstrap, and run
$application = new Zend_Application(
    APPLICATION_ENV,
    APPLICATION_PATH . '/configs/application.ini'
);
$application->bootstrap();

/** Cronjobs don't need all the extra's **/
if(!defined('_CRONJOB_') || _CRONJOB_ == false)
{
    $application->bootstrap()->run();
}

However now when i now try to run the script, I get the message:

Message: Invalid controller specified (scripts).

Does it mean that I need to create a controller for the purpose? But the script folder is outside the application folder. How do i fix this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T07:46:20+00:00Added an answer on May 27, 2026 at 7:46 am

    Thanks all for your answers. However the solution that worked for me came from this site Howto: Zend Framework Cron. The original link is dead, but its copy can be found on Internet Archive.

    I am posting a cut of the code here. But please this is not my solution. All credits goes to the original author.

    The trick with cronjobs is that you do not want to load the whole View
    part of ZF, we don’t need any kind of HTML output! To get this to
    work, I defined a new constant in the cronjob.php which I will check
    for in the index.php.

    cronjob.php

    define("_CRONJOB_",true);
    require('/var/www/vhosts/domain.com/public/index.php');
    // rest of your code goes here, you can use all Zend components now!
    

    index.php

    date_default_timezone_set('Europe/Amsterdam');
    
    // Define path to application directory
    defined('APPLICATION_PATH')
    || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
    
    // Define application environment
    defined('APPLICATION_ENV')
    || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
    
    // Ensure library/ is on include_path
    set_include_path(implode(PATH_SEPARATOR, array(
    realpath(APPLICATION_PATH . '/../library'),
    get_include_path(),
    )));
    
    /** Zend_Application */
    require_once 'Zend/Application.php';
    
    // Create application, bootstrap, and run
    $application = new Zend_Application(
    APPLICATION_ENV,
    APPLICATION_PATH . '/configs/application.ini'
    );
    $application->bootstrap();
    
    /** Cronjobs don't need all the extra's **/
    if(!defined('_CRONJOB_') || _CRONJOB_ == false)
    {
    $application->bootstrap()->run();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a ZendFramework project that I would like to run inside a subdirectory.
Hi I have a zendframework project. Now it is running in my domain (http://www.mydomain.com).
I have a zend framework project. In the public folder I have js and
I'm Using ZendFramework-1.0.4 and I don't have any idea how does it wrap the
I have a PHP5/Zend Framework 1.8.1 web site which is located at: http://www.example.com/foo The
I've got a pretty default ZF project, but I need to add TinyMCE to
just simple question, recently i have setup a web server to build project using
In my Zend Framework project, I have a form that I am testing. In
I have been using svn:externals to bring the Zend Framework files into my project.
I have a project written with zend framework. I was using xampp for my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.