Solution: Tips Running - Cronjobs and scripts with required arguments in limited hosting environment

Previous Title

Running cronjobs and scripts with required arguments / parameters in limited hosting environment


How can I run eZ Publish scripts and cronjobs with parameters on shared hosting without ssh.

You may only be allowed to run php files as a cronjob without any parameters and without the possibility to browse eZ Publish directory.

You also may not have command line access. Yeah, this can be pretty frustrating, but can not find or afford a better hosting solution.


When your provider doesn't allow you to run cronjob tasks with parameters and when your server runs php-cgi.

In order to run cronjob task with parameters, you can create a separate php file and then create a cronjob task pointing to that file.

Custom Script Example

Here is an example of the solution using the data_import extension as an example.

File: /path/to/ezpublish/extensions/custom/cronjobs/run_custom_cronjob_script.php


The above example creates an output (as seen in the code) so you will know if your import is successful or not.

Web Browser Example

You may for very small tasks be able to run the above file from a web browser as long as the script completes quickly as browser requests do not work well with long running tasks.

The following tasks have been reported to be able to be run from the web browser with success if only limited. Most successes have been reported to resolve around limited execution time.

  • Scripts: Custom Scripts - Try limiting the execution time
  • Cronjobs: Data Import - Try limiting how much complicated data import you attempt each time
  • Database: Dump / Load / Custom SQL- Try using phpmyadmin or other dba tools