Overwrite module phtml file and re-write in own theme Magento 2

Some day ago I am facing one issue in magento 2  with overwrite module’s PHTML file in my custom theme,

So  here is the solution ,


  1. Copy the Phtml file from module (For module location On template path hint)
  2. go to MAGENTO_ROOT/app/design/frontend/VENDOR/YOUR_THEME/MODULE_NAME/templates/filename.phtml

Here MODULE_NAME is your module name from you copy the phtml file In my case its Magento_Search.



Error after Magento 2 upgrade command

After firing this command from your terminal  “php bin/magento setup:upgrade" If you get blank screen or your website crash and you get error in your log file, then just follow below steps to solve the issue.

Here the simple steps are

  1. Delete the “di” folder located in var directory via cpanel or FTP
  2. Log into your terminal via ssh access and go to your magento root directory
  3. Run this command to change directory command: “cd bin”
  4. Then run this command “sudo ./magento setup:di:compile”
  5. Go back to your magento root directory
  6. Finally give file/directory permissions through command.
  7. Clear the cache and check your website is working now.