0

Recently I installed Mpdf library using composer in my Magento 2.1.7 local setup, and It is working perfect on localhost. Now I have to move those libraries to live server (I can not install there through composer as I don't have permission.) for that I have moved mpdf directory from magentoRoot/vendor/mpdf at same path on live, but it is not working on live server and throwing below error

Uncaught Error: Class 'Mpdf\Mpdf' not found

After moving files I have ran setup:upgrade and content:deploy commands. What I am missing here? Is there any other changes needed along with moving the library files?

  • 1
    Did you check vendor/composer/autoload_psr4.php? Magento 2 need to recognize your library through autoload. – Sohel Rana Jan 27 '18 at 17:08
  • @SohelRana yes, there was code missing for Mpdf, I added it and ran content:deploy command, but error is still there – Piyush Jan 27 '18 at 17:16
  • 1
    @SohelRana thank you for guiding me to the right path, along with autoload_psr4.php I have to make changes in vendor\composer\autoload_static.php to make it work. Please add your comment as answer so I can accept it – Piyush Jan 27 '18 at 18:27
1

Did you check vendor/composer/autoload_psr4.php? Magento 2 need to recognize your library through autoload.

  • @Piyush glad to hear that it’s working for you. – Sohel Rana Jan 28 '18 at 1:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.