Mautic 3.1.1 (newly installed it myself from mautic.org)
Cronjobs produce errors:
/[redacted]/php /home/www/mautic/bin/console mautic:segments:update >>/[redacted]/logs/mautic-segments-update.log 2>&1
/[redacted]/php /home/www/mautic/bin/console mautic:campaigns:update >>/[redacted]/logs/mautic-campaigns-update.log 2>&1
/[redacted]/php /home/www/mautic/bin/console mautic:campaigns:trigger >>/[redacted]/logs/mautic-campaigns-trigger.log 2>&1
Each one repeatedly yield following log output: PHP Warning: Class ‘Tightenco\Collect\Support\LazyCollection’ not found in /[redacted]/mautic/vendor/tightenco/collect/src/Collect/Support/alias.php on line 19 PHP Parse error: syntax error, unexpected ‘=’ in /[redacted]/mautic/vendor/tightenco/collect/src/Collect/Support/LazyCollection.php on line 611
I am aware that there are two threads dealing with the same output message:
However, the solution was to 1) upgrade MySQL version, and to 2) upgrade a php version. For both I already had been using higher versions
What I tried
Downgrading php to 7.3 or 7.2 → No change, warnings/errors persist
Manually runing cronjobs via ssh yield same output
I changed php to 7.3.22, restarted Apache and via ssh I issued
/[…]/bin/php /[…]mautic/bin/console cache:clear -vvv
Interestingly, I get the exact same error messages in PuTTY, even when doing a /bin/console --?
PHP Warning: Class ‘Tightenco\Collect\Support\LazyCollection’ not found in /[…]/mautic/vendor/tightenco/collect/src/Collect/Support/alias.php on line 19
PHP Parse error: syntax error, unexpected ‘=’ in /[…]/mautic/vendor/tightenco/collect/src/Collect/Support/LazyCollection.php on line 611
Is there some other way to manually clear the cache? Or can you point me to some docs? Sorry, I am not realy an ssh cli artists here.
Is this a clean vps or you are using some sort of control panel?
If it won’t hurt, I’ll suggest deploying another instance of Clean VPS, and this time, make sure you are using php 7.3.
if you can’t redeploy a new one or you are using a control panel, try to locate the path where your php is installed (type which php in the console to see the path), if you found it, test run in the shell using the full php path, e.g
I am actually on a shared server, but I do have my own exclusive apache running on it. Still, I do set php version via GUI.
Requirements are satisfied. In the first step of the installation - when routine checks for missing components in the environment - nothing is reported, I just get the green ok.
I now deleted and reinstalled mautic (including entire MySQL db) under php 7.3.22.
Interestingly, still no change. When I manually run the tasks for cronjobs via ssh I get the very same error as before.
Maybe it has something to do with php configuration?
This is what i see from php.ini (some are my additions):
Solved it. @EJL, You brought me on the right track:
While phpinfo() outputs php7.3 as I expected, running php -v on the CLI revealed that SSH and cron jobs are actually running with php 7.0.
So I had to learn that setting the php version in hoster’s GUI (some homebrew, not cPanels) does only affect the version my apache is using. CRONs and ssh were always running with php 7.0, independent of any GUI settings. Mind that. Hence the errors.
After talking to the hoster they gave me access to the 3.7 files, which I call now in the cron with a fully qualified path. Working like a charm now.
Thanks guys, simple solution but it needed your input to grasp whats going on.