Class in vendor not found

I have uguranyum/yii2-icalender installed. I run it from console. It works just fine on my local machine. But on the remote site, I get the error:

2019-08-28 12:00:02 [-][-][-][error][Error] Error: 
Class 'uguranyum\icalender\iCalender' not found 
in /var/www/vhosts/mySite/httpdocs/console/controllers/CalendarController.php:28 

Stack trace: 
#0 /var/www/vhosts/mySite/httpdocs/console/controllers/CalendarController.php(64): console\controllers\CalendarController->actionInit('2019-08-28', '2019-08-28')
#1 [internal function]: console\controllers\CalendarController->actionIndex() 
#2 /var/www/vhosts/mySite/httpdocs/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array) 
#3 /var/www/vhosts/imySite/httpdocs/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array) 
#4 /var/www/vhosts/mySite/httpdocs/vendor/yiisoft/yii2/console/Controller.php(148): yii\base\Controller->runAction('index', Array) 

I’ve checked the namespace and have tried changing the file permissions. I’m not sure what else to look for.

use common\models\Utility;
use common\models\group\IcalenderMain;
use common\models\group\GroupIcalendarUrl;
use fedemotta\cronjob\models\CronJob;
use uguranyum\icalender\iCalender;
use yii\console\Controller;

    class CalendarController extends Controller
    {
        /**
         * Clean iCalendar tables and do a fresh import for all icalendar urls
         * @param string $from
         * @param string $to
         * @return int exit code
         */
        public function actionInit($from, $to) {
            $dates  = CronJob::getDateRange($from, $to);
            $command = CronJob::run($this->id, $this->action->id, 0, CronJob::countDateRange($dates));
            if ($command === false) {
                return Controller::EXIT_CODE_ERROR;
            } else {
                foreach ($dates as $date) {
                    iCalender::cleanTables();

How ?

And how have you installed it on the remote site?
Vendor directory exists?
vendor/uguranyum/yii2-icalender exists?

Yes, vendor/uguranyum/yii2-icalender exists.
I installed my update on the remote by running composer install (with the lock file from my local machine).
There’s no issue with the console command itself. It runs just fine, as do many other console commands that I have created previously. The issue is just when it hits any reference to iCaldender.

Have you checked user and group permissions?

Yes, I’ve checked those. They have the same ownership and permission as other installed and functioning extensions. Just for kicks I gave the controller file full 777 permission, but to no avail.

composer’s autoload is case sensitive.

please rename the file vendor/uguranyum/icalender/icalender.php to vendor/uguranyum/icalender/iCalender.php (camelcase, lower “i” upper “C”)

If this solve the problem, open a issue at github.com/uguranium

3 Likes

Yes, that solves the problem. I initially suspected the issue was case-related, but did not connect it to Composer. Thank you!