peppeocchi / php-cron-scheduler

PHP cron job scheduler
MIT License
808 stars 143 forks source link

PHP Fatal error: Uncaught Error: Class "GO\Scheduler" not found in. - Question not Issue #150

Closed 10029759 closed 4 months ago

10029759 commented 4 months ago

This is my working example code that runs as expected on local host

require_once __DIR__.'/vendor/autoload.php'; use GO\Scheduler; $scheduler = new Scheduler(); $scheduler->php(__DIR__.'/cron/wonde/job.php')->everyMinute();

But when I run this on a Linix Server directly in the terminal.... like this

/usr/bin/php /var/www/absolute-education/public_html/cron-scheduler.php

Then it throws an error...

`PHP Fatal error: Uncaught Error: Class "GO\Scheduler" not found in /var/www/absolute-education/public_html/cron-scheduler.php:8 Stack trace:

0 {main}

thrown in /var/www/absolute-education/public_html/cron-scheduler.php on line 8`

Any thoughts why this is happening?

I'm logged into the server as the website administrator, so have the correct permissions to read, write files.

10029759 commented 4 months ago

I've also tried ...

require_once __DIR__.'/vendor/peppeocchi/php-cron-scheduler/src/GO/Scheduler.php';

This still produces the same error.

10029759 commented 4 months ago

Ok, I have managed to fix the issue. I remove the pacage via composer then required it back in. I'm guessing that it wasn't in my compsoser lock file correctly.