en Jump to content
  • 0

Prestashop and cron jobs or cli




I'm trying to use cron jobs to set some things up and don't have to do them everyday.

One example is the currency rate update, another is the search indexation, and a few modules/scripts i wrote myself.


I found that include('config/config.inc.php'); doesn't work for me from cli (and a cron job).

The script haults at this line, doesn't do anything, doesn't output an error, even after i turned display errors,...

I could use wget, but it's not quite the same and it creates file in root.

My only solution was to include('config/settings.inc.php'); and use PDO to access the database. Which is ok, but this way i can't use the built in functions/classes/...


I reported on the currency update in http://forge.prestashop.com/browse/PSCFV-8879. The answer being it was fixed. Maybe it is, i haven't updated from 1.5.2. But cron_currency_rates.php is the same. And refreshCUrrencies seems the same in


Am i the only one with these problems? Has anyone found a solution?


Share this post

Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0

I have the same bug.

In PHP-CLI, this line doen't work correctly :

// line 90 from config.inc.php
$context->shop = Shop::initialize();

Share this post

Link to post
Share on other sites
  • 0

I found a simpler solution to this problem. In your script, just before you include the config.inc.php file, add the following define:


define('_PS_ADMIN_DIR_', getcwd());


Problem solved!

Edited by emokemi

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More