【发布时间】:2020-05-22 22:10:10
【问题描述】:
我正在开发一个 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. [] []
我花了一天的大部分时间来解决这个问题。
非常感谢任何人都可以提供的任何指导。
【问题讨论】:
-
您的
command运行成功了吗? -
尝试找出您的 Web 服务器错误日志的位置会很有帮助。看起来您正在查看 magento 日志,但 500 错误的详细信息将显示在 Web 服务器(例如 apache)日志中
-
是的,所有命令都运行良好。 @mozboz 我已使用服务器日志中的日志更新了问题。我已进一步查看报告的错误,但无法解决。
标签: php magento2 internal-server-error