Developer mode Magento 2

Hi,

When I put my site in to developer mode using the following command:
php bin/magento deploy:mode:set developer

I cannot access frontend or admin area.

I run the following command:
chown -R : /home/****/public_html

This resets all the permissions and I can then get in front and back end.

When I click on a product on my site I get this error:
Exception #0 (Exception): Warning: Invalid argument supplied for foreach() in /home/thegift/public_html/app/code/Mageplaza/Search/Helper/Data.php on line 345

Can anyone shed any light on this.

It works fine in default mode but when in developer mode I get the error

Thanks
Andy

Hey @GiftedFox,

I’ve not come across this issue before, but I suspect it’s an Owner/Group Permission issue (But I could be wrong). There’s a few things I’d check before trying anything too crazy. Apologies if I’m pointing out the obvious, but I like to be thorough and it might help others in a similar position.

Switching to Developer Mode
Not sure if you did this when switching to Developer Mode, but you’re required to clear our the following folders with this command:

rm -rf <your Magento install dir>/generated/metadata/* <your Magento install dir>/generated/code/*

Checking File Owner/Group
Assuming the File Owner/Group of your Magento installation is “bob”, ensure that:

  1. Your cron tasks are being executed as “bob”. If they run as root, they’ll make key files/folders un-editable until they’re changed back
  2. You reset your ownership of all files/folders e.g. chown -R bob:bob <your Magento install dir>. You may have to run this as a root user if an error occurs.
  3. You always execute all bin/magento tasks as “bob” (same reason as #1)

Exception Report
What are the next few lines of on the Exception error. The first line mentions the File and line number, but the next 5-10 lines after that might shed more light. You can use Pastebin.com (or similar) if you want to copy and paste the whole thing on there instead of here.