2

I have installed two Magento's at my live server of version 2.1.7 & 2.1.8 When I am deleting some files from /Var folder it is giving me error in my system like bellow

In CMD

[Exception]
  Warning: ltrim() expects parameter 1 to be string, object given in /home/av
  iansrollplug/public_html/alpha/vendor/magento/framework/Code/Generator/Enti
  tyAbstract.php on line 152

On site

RuntimeException: Source class "" for "Magento\Framework\App\Response\Http\Interceptor" generation does not exist. in magento_root/vendor/magento/framework/Code/Generator.php:185

I have deleted the below folders from /var folder

var/Cache
var/generation
var/page_cache
var/tmp
var/view_processed

Why it is happening? When I had deleted it first time in normal way (let it be present in trash) it was working but when I deleted it completely that it should not store any data into trash then it started generating this error

Please If any one can help into this?Where I need to do changes? I didn't altered anything into the core files of Magento

  • Do you set the permission to the var folder? – Nero Phung Dec 18 '17 at 7:09
  • In what mode is your site running? Run command bin/magento deploy:mode:show to check this. Also see the docs on this: devdocs.magento.com/guides/v2.0/config-guide/cli/… – 7ochem Dec 19 '17 at 15:06
  • do you have run the commad: php bin/magento setup:static-content:deploy – Ashish Raj Dec 19 '17 at 17:38
  • I am running in developer mode & when I ran any command of magento it is giving that it is not existing into it & generates the CMD command given in my question & yes I tried to run the setup:static-content:deploy command as well – Abhishek Tripathi Dec 20 '17 at 15:36
0

Don't delete the folders, delete the content of the folders. I just tested this in M2.1.9 and got the same error.

You can use your OS file browser, but I'd recommend using the command line. Here is an example for Linux/Mac:

rm -rf var/cache/* var/generation/* var/page_cache/* var/tmp/* var/view_processed/*

If you're unfamiliar with the above command you should be very careful not to type it incorrectly and accidentally delete the wrong folder (or worse, everything, i.e. /).

Also good to know, if you run rm -rf pub/static/* will delete all but hidden files, such as pub/static/.htaccess. It wasn't in your example but you might run into it down the road.

To fix your current situation recreate the folders. A permission fix might be necessary. For me, some content was partially generated and the error stuck around, so I ended up having to clear the var/generation folder again.

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.