Mautic Error: Failed to open stream: Permission denied

Hi Everyone,

The following Cron Job configuration:

/usr/local/bin/php /home/mautic/public_html/mautic.devced.com/bin/console mautic:emails:send

Produced the following terminal error message:

In StreamHandler.php line 110:

The stream or file “/home/mautic/public_html/mautic.devced.com/app/…/var/logs/mautic_prod-2023-10-19.php” could not be opened in append mo
de: Failed to open stream: Permission denied

How do I remove the ’ StreamHandler.php line 110" error message?

Thanks,
Hal
DevCED Team

You need to set your permissions properly. Once the script has a right to write, it will work.

Does the provided cron job commands includes a right to write:

*/15 * * * * /usr/local/bin/php /home/mautic/public_html/mautic.devced.com/bin/console mautic:broadcasts:send --batch-limit=1000 >/dev/null 2>&1
5,20,35,50 * * * * /usr/local/bin/php /home/mautic/public_html/mautic.devced.com/bin/console mautic:emails:send --message-limit=1000 >/dev/null 2>&1
10,25,40,55 * * * * /usr/local/bin/php /home/mautic/public_html/mautic.devced.com/bin/console mautic:campaigns:rebuild --batch-limit=1000 >/dev/null 2>&1
15,30,45,0 * * * * /usr/local/bin/php /home/mautic/public_html/mautic.devced.com/bin/console mautic:campaigns:trigger --batch-limit=1000 >/dev/null 2>&1
20,35,50,5 * * * * /usr/local/bin/php /home/mautic/public_html/mautic.devced.com/bin/console mautic:import --limit=500 >/dev/null 2>&1
25,40,55,10 * * * * /usr/local/bin/php /home/mautic/public_html/mautic.devced.com/bin/console mautic:reports:scheduler >/dev/null 2>&1

It depends who is executing them.

Here is a tutorial:

1 Like

Hi Joey,

The cron job command appears to be in working order:
/usr/local/bin/php /home/mautic/public_html/mautic.devced.com/bin/console mautic:emails:send >/dev/null 2>&

Last 15 cron job commands:

[mautic@team ~]$ sudo grep mautic /var/log/cron | tail -15
[sudo] password for mautic:Oct 20 16:04:12 team crontab[2054019]: (mautic) LIST (mautic)
Oct 20 16:04:21 team crontab[2054024]: (mautic) LIST (mautic)
Oct 20 16:04:22 team crontab[2054027]: (mautic) LIST (mautic)
Oct 20 16:05:01 team CROND[2054150]: (mautic) CMD (***/usr/local/bin/php /home/mautic/public_html/mautic.devced.com/bin/console mautic:emails:send >/dev/null 2>&***1)
Oct 20 16:05:01 team CROND[2054151]: (mautic) CMD (/usr/local/bin/php /home/mautic/public_html/mautic.devced.com/bin/console mautic:import --limit=500 >/dev/null 2>&1)
Oct 20 16:10:01 team CROND[2054403]: (mautic) CMD (/usr/local/bin/php /home/mautic/public_html/mautic.devced.com/bin/console mautic:campaigns:rebuild --batch-limit=1200 >/dev/null 2>&1)
Oct 20 16:10:01 team CROND[2054405]: (mautic) CMD (/usr/local/bin/php /home/mautic/public_html/mautic.devced.com/bin/console mautic:reports:scheduler >/dev/null 2>&1)
Oct 20 16:15:01 team CROND[2054566]: (mautic) CMD (/usr/local/bin/php /home/mautic/public_html/mautic.devced.com/bin/console mautic:broadcasts:send >/dev/null 2>&1)
Oct 20 16:15:01 team CROND[2054568]: (mautic) CMD (/usr/local/bin/php /home/mautic/public_html/mautic.devced.com/bin/console mautic:campaigns:trigger --batch-limit=1200 >/dev/null 2>&1)
Oct 20 16:20:01 team CROND[2054869]: (mautic) CMD (/usr/local/bin/php /home/mautic/public_html/mautic.devced.com/bin/console mautic:emails:send >/dev/null 2>&1)
Oct 20 16:20:01 team CROND[2054873]: (mautic) CMD (/usr/local/bin/php /home/mautic/public_html/mautic.devced.com/bin/console mautic:import --limit=500 >/dev/null 2>&1)
Oct 20 16:25:02 team CROND[2055239]: (mautic) CMD (/usr/local/bin/php /home/mautic/public_html/mautic.devced.com/bin/console mautic:campaigns:rebuild --batch-limit=1200 >/dev/null 2>&1)
Oct 20 16:25:02 team CROND[2055238]: (mautic) CMD (/usr/local/bin/php /home/mautic/public_html/mautic.devced.com/bin/console mautic:reports:scheduler >/dev/null 2>&1)
Oct 20 16:30:02 team CROND[2055542]: (mautic) CMD (/usr/local/bin/php /home/mautic/public_html/mautic.devced.com/bin/console mautic:broadcasts:send >/dev/null 2>&1)
Oct 20 16:30:02 team CROND[2055543]: (mautic) CMD (/usr/local/bin/php /home/mautic/public_html/mautic.devced.com/bin/console mautic:campaigns:trigger --batch-limit=1200 >/dev/null 2>&1)
[mautic@team ~]$

Regards,
Hal
DevCED

My question was who is executing the cron?
Sudo?
Web user?
Also: did you clear cache withe the we user? Did you set permissions?

Q: Who is executing the cron?
A: cPanel user: sudo mautic

Q: Also: did you clear cache withe the we user? Did you set permissions?
A: Let me address this with cPanel Support

Ok good. All my answers are already in the article above, and gives you a proper solution.

cPanel is waiting for a response from Google Cloud Panel Support.

Hi Joeyk,

Right on the money. cPanel Tech Support Team confirmed your diagnosis.

2023-10-24 20.04.34 imap.cfored.com 5ed9399f40b4

2023-10-24 20.19.23 imap.cfored.com 2e6edc876f83

How to change ownership of a file or directory,

Thanks,
Hal
DevCED Team