Anyone here that knows how to setup cron jobs in Plesk?
We just moved to a new VPS server where we use Plesk to partition the server into various functions.
I been sitting for several hours searching and testing and so far I had no success.
It just fails with the following:
**Task "public_html/cron.php" completed with error in 0 seconds, output:**
Task "public_html/cron.php" completed with error in 0 seconds, output:
PHP Fatal error: Uncaught TypeError: imap_expunge(): Argument #1 ($imap) must be of type resource, bool given in /var/www/vhosts/example-domain.com/public_html/include/Imap/ImapHandler.php:517
#0 /var/www/vhosts/example-domain.com/public_html/include/Imap/ImapHandler.php(517): imap_expunge()
#1 /var/www/vhosts/example-domain.com/public_html/modules/Schedulers/_AddJobsHere.php(720): ImapHandler->expunge()
I also tried to directly schedule the cron job in Plesk admin to run under www-data but that also fails.
I’ve also tried https://workcron.com/cron-job-tutorials/how-to-set-up-cron-job-for-suitecrm
But that is resulting in 500 internal server error when running cron by calling it from the browser.
I also attempted this suggestion:
with running it as wget. That also fails.
So honestly; I’m out of ideas…
Would appreciate greatly any suggestion that would lead me on the right track.
It doesn’t look like you have a problem running cron jobs, what you have is a specific cron job giving a FATAL error…
Hmm if that is the case, then what can be done to fix it?
The error seems to be inbound email. If you don’t need it, then disable that job, and the others should run fine. Keep an eye on Admin / Schedulers, enter each job and check “Last ran successfully” field to understand what’s happening.
If you need it, you need to figure out which part of the inbound email configuration is broken… which can be a tricky thing to do
Thanks @pgr I’ll look into it.
It could not just be a matter of corrupted files?
I mean normally this should work out of the box right?
That FATAL looks just like the IMAP errors that people are getting with the new changes in Microsoft Accounts. It simply looks like the job that grabs email is unable to do so (and unable to fail gracefully)
I found a solution @pgr.
It all came down to the allowed user for cron jobs.
I created this file and called it test.php (Saved it in www root), and added this code:
after that ran the test.php file in the browser which then prints the current user used for the cron jobs and changed it in the config.php file to that user.
0 => 'www-data',
1 => 'my-allowed-user-name',
Then after that setup the cron job in Plesk CP scheduled jobs as a php script:
Then hit the “Run Now” button to test and boom!
Nice. Can you please check the instructions at the bottom of Admin/Schedulers? Is your user well identified there?
I’m just checking if that code is running well
Yes, the user is checking out nicely with what SuiteCRM tells you on that page too.