2

Getting following error while compilation using this command : php bin/magento setup:di:compile after upgrade Magento 2.1.7 to 2.1.9 check below error for more information :

Warning: ltrim() expects parameter 1 to be string, array given in /MagentoRoot/setup/src/Magento/Setup/Module/Di/Compiler/Config/Chain/BackslashTrim.php on line 61

1

I would assume this is related to (read/write/execute) to var and pub directory.

sudo chmod -R 777 var pub

Also, try clearing the cache

sudo rm -rf var/cache/* var/generation/*

However it might be something to do with the di folder, this might also work:

  1. Delete the di folder from the var directory
  2. sudo php bin/magento setup:di:compile
  3. Reset file permissions.
  • I have already tried this lots of times. but getting error every time. – Aasim Goriya Oct 2 '17 at 11:02
  • delete vendor and reinstall. Have you tried this ? – andy jones Oct 2 '17 at 11:10
  • FYI site is working fine but compilation not working. Also can you please tell me what needs to be reinstall ? – Aasim Goriya Oct 2 '17 at 11:14
-1

Issue fixed after run following commands in root directory

644 permission for files

find . -type f -exec chmod 644 {} \;

755 permission for directory

find . -type d -exec chmod 755 {} \;

777 permission for var folder

find ./var -type d -exec chmod 777 {} \;

And following commands for pub/media and pub/static

find ./pub/media -type d -exec chmod 777 {} \;

find ./pub/static -type d -exec chmod 777 {} \;

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.