首页 > 解决方案 > 从本地 git 部署 Azure php 错误 - 使用教程

问题描述

所以我是 azure 部署的新手,我尽量使用 microsoft 文档教程 https://docs.microsoft.com/en-us/azure/app-service/tutorial-php-mysql-app?pivots=platform -视窗

一切都很好,直到“部署到 Azure” 步骤:

git推送天蓝色主

remote:   [ErrorException]
remote:   Trying to access array offset on value of type null
remote: An error has occurred during web site deployment.
remote:
remote: composer failed
remote:
remote:
remote: Error - Changes committed to remote repository but deployment to website failed.
To https://phpmysqldemogs.scm.azurewebsites.net/phpMysqlDemoGS.git

部署中心 > 日志中的日志详细信息显示我使用详细日志提交失败

Command: bash deploy.sh
 Creating app_offline.htm
 KuduSync.NET from: 'C:\home\site\repository' to: 'C:\home\site\wwwroot'
 Deleting app_offline.htm
 Running composer install
    
                                                           
   [ErrorException]                                     
   Trying to access array offset on value of type null  
                                                           
 An error has occurred during web site deployment.
    
 composer failed
 [ErrorException]                                     \r\n  Trying to access array offset on value of type null\r\nC:\Program Files (x86)\SiteExtensions\Kudu\95.30831.5373\bin\Scripts\starter.cmd bash deploy.sh

我尝试再次推送,它说“已经是最新的”

我试图从 azure 克隆 repo,执行 composer install 然后 php artisan serve ...它在本地工作,所以我认为问题出在部署配置中。任何人都可以帮助解决生产问题吗?

提前致谢。

标签: phpazure

解决方案


Error - Changes committed to remote repository but deployment to website failed.当您推送与“azure”上的应用程序部署分支不匹配的本地分支时,会发生此错误。

  • 要解决此错误,请验证当前分支是否为master. 要更改默认分支,请使用DEPLOYMENT_BRANCH应用程序设置(请参阅更改部署分支)。

你也得到了Trying to access array offset on value of type null错误,那是作曲家失败。

  • 要解决此错误,您需要更新作曲家。
composer update

或者

php composer.phar update

在此处输入图像描述

您可以参考疑难解答部署错误“尝试访问 null 类型值的数组偏移量”


推荐阅读