I tried about solutions without result. I wasnt able to clear cache by cli or by admin/clearcache.php since i continue getting the same error. Then I deleted the cache folder in moodledata recreated and then finally could run the php scripts. Your response worked for me.
Thanks for sharing