Magento 2 - 迁移到不同的文件夹后,500内部服务器错误

问题描述 投票:0回答:1

我正在做一个Magento 2网站,我已经做了一个网站的副本,以便将其复制到同一服务器上的不同文件夹,用于暂存生产环境。

我进行了以下操作。

  • 复制所有文件和文件夹
  • 复制数据库
  • 将所有文件复制到新文件夹
  • 创建新数据库
  • 导入数据库副本,但更改了URL
  • 更新配置指向新的数据库
  • 删除了var, vendor & pub静态内容。
  • 运行以下命令。

- composer install

- php bin/magento setup:upgrade

- php bin/magento setup:di:compile

- php bin/magento setup:static-content:Deploy -f

- chmod -R 777 var/ generated/ pub/static

- php bin/magento cache:clean

- php bin/magento cache:flush

- bin/magento indexer:reindex


我还启用了错误和开发者模式 当我访问主页时,我得到一个500内部服务器错误,但没有可见的错误。

管理面板和子页面似乎工作正常,但得到一个空屏幕500错误的主页。

我在服务器日志中看到以下错误。


[23-May-2020 07:54:49 UTC] PHP Fatal error:  Uncaught Error: Call to a member function addAttributeToFilter() on null in /var/www/vhosts/websitename/htdocs/app/code/Sm/FilterProducts/Block/FilterProducts.php:276
Stack trace:
#0 /var/www/vhosts/websitename/htdocs/app/code/Sm/FilterProducts/Block/FilterProducts.php(201): Sm\FilterProducts\Block\FilterProducts->_featuredProducts()
#1 /var/www/vhosts/websitename/htdocs/app/code/Sm/FilterProducts/Block/FilterProducts.php(496): Sm\FilterProducts\Block\FilterProducts->_getProducts()
#2 /var/www/vhosts/websitename/htdocs/generated/code/Sm/FilterProducts/Block/FilterProducts/Interceptor.php(102): Sm\FilterProducts\Block\FilterProducts->getLoadedProductCollection()
#3 /var/www/vhosts/websitename/htdocs/app/design/frontend/Sm/shiny/Sm_FilterProducts/templates/default-grid.phtml(15): Sm\FilterProducts\Block\FilterProducts\Interceptor->getLoadedProductCollection()
#4 /var/www/vhosts/websitename/htdocs/vendor/magento/framework/View/TemplateEngine/Php.php(59): include('/var/ww in /var/www/vhosts/websitename/htdocs/app/code/Sm/FilterProducts/Block/FilterProducts.php on line 276


当我查看magento调试日志时,我看到以下错误。

[2020-05-22 22:01:55] main.INFO: Broken reference: the 'wishlist_sidebar' element cannot be added as child to 'sidebar.additional', because the latter doesn't exist [] []
[2020-05-22 22:01:55] main.INFO: Broken reference: the 'yotpo_bottomline' element cannot be added as child to 'product.info.main', because the latter doesn't exist [] []
[2020-05-22 22:01:55] main.INFO: Broken reference: the 'banner-sidebar' element cannot be added as child to 'sidebar.additional', because the latter doesn't exist [] []
[2020-05-22 22:01:55] main.INFO: Broken reference: the 'footer_blog_link' element cannot be added as child to 'footer_links', because the latter doesn't exist [] []
[2020-05-22 22:01:55] main.INFO: Broken reference: the 'paypal.partner.right.logo' element cannot be added as child to 'sidebar.additional', because the latter doesn't exist [] []
[2020-05-22 22:01:55] main.INFO: Broken reference: the 'bml.right.logo' element cannot be added as child to 'sidebar.additional', because the latter doesn't exist [] []
[2020-05-22 22:01:55] main.INFO: Broken reference: the 'yotpo_bottomline' tries to reorder itself towards 'product.info.addto', but their parents are different: 'product.info.main' and '' respectively. [] []


我已经花了大半天的时间在这上面,但一直没能找出问题所在。

非常感谢任何人可能提供的任何指导。

php magento2 internal-server-error
1个回答
0
投票

我从应用程序目录重新复制文件,它解决了这个问题。我相信我可能遗漏了一些类。


0
投票

我不知道magento,但根据Wordpress和其他大型PHP应用程序的经验,我会倾向于先做这些步骤,然后看看会发生什么。你可能会发现,你正在做的magento命令行的事情是以某种方式与你的配置或数据拧紧 - 不要运行它们,直到安装工作第一。

所以,尝试重新开始,但只做这些步骤。

  • 复制文件到新的位置
  • 复制数据库到新的数据库
  • 抽查所有到达的文件,包括.文件(如.htaccess)。
  • 抽查新的数据库是否在你所期望的位置。
  • 更新数据库配置
  • 只更新Magento的配置来更改URL,路径和数据库设置。不要改变其他任何东西
  • 测试看看会发生什么

可能会有一些magento特有的清除缓存之类的东西,如果在你开始这个过程之前,在不破坏你的prod环境的情况下,有可能做到这一点的话,尽量做到这一点。


0
投票

我不懂magento,但根据Wordpress和其他大型PHP应用的经验,我会倾向于先做这些步骤,然后看看会发生什么。你肯定不想做多个步骤,比如升级magento,同时你也要把它移到一个新的位置。你可能会发现,你正在做的magento命令行的东西是以某种方式与你的配置或数据拧 - 不要运行它们,直到安装工作第一。

所以,尝试重新开始,但只做这些步骤。

  • 复制文件到新的位置
  • 复制数据库到新的数据库
  • 抽查所有到达的文件,包括.文件(如.htaccess)。
  • 抽查新的数据库是否在你所期望的位置。
  • 只更新Magento的配置来更改URL,路径和数据库设置。不要改变其他任何东西
  • 测试看看会发生什么

可能会有一些magento特有的清除缓存之类的东西,如果在你开始这个过程之前,在不破坏你的prod环境的情况下,完全可以做到这一点的话,尽量做到这一点。

© www.soinside.com 2019 - 2024. All rights reserved.