Reputation: 332
i have worked on project in advanced yii2 , it works fine in localhost but after i upload it there is a message appear that says :
Class 'kartik\select2\select2' not found
the weird thing is : select2 works fine in localhost and i upload all the files
Upvotes: 1
Views: 5087
Reputation: 138
Your solution could be:
use kartik\select2\Select2;
Maybe you are using Windows on localhost and Linux on the remote server.
Upvotes: 4
Reputation: 3762
When moving your code to production, you have to install all libraries used by composer with
composer install
or
php composer.phar install
Then the same versions of libraries get installed as on your dev site where you tested the application.
This is the reason why in .gitignore the file composer.lock is NOT included: Just to ensure the same lib versions on dev and prod sites.
Upvotes: 0
Reputation: 558
If you don't have access to a command line interface in your server to run the composer update command, you need to upload the folder "vendor/composer/" and the "vendor/autoload.php" file to your web server.
Upvotes: 0
Reputation: 5032
I assume, that you didn't something like "download to localhost kartik select2, then just copy&paste /vendor/kartik-v/yii2-widget-select2
to server. I hope. Because you shouldn't do like that.
Add this line to require section in project-directory/composer.json file
"kartik-v/yii2-widget-select2": "@dev"
Then run in project directory command:
composer update
Upvotes: 0