我正在将我的PHP应用程序部署到Microsoft Azure平台。在部署时它运行composer install
并且它在窗口中的反斜杠存在问题:对于项目中的每个类和库,它使用/和\作为路径分隔符解析文件。这种错误的数十种出现了:
Warning: Ambigous class resolution. "SomeClass" was found in both
"D:/home/site/wwwroot/vendor/somevendeor/somelib/src/SomeClass.php" and
"D:\home\site\wwwroot\vendor\somevendeor\somelib\src\SomeClass.php"
解析每个文件两次并通过网络打印所有错误需要很长时间才能取消作曲家进程。部署失败10次(使应用程序处于无效,无法运行状态)。
有谁知道可以做些什么?我很欣赏每一个提示!谢谢:))
编辑:这是我的composer.json:
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"require": {
"laravel/framework": "4.2.*",
"cartalyst/sentry": "2.0.*",
"facebook/php-sdk-v4": "4.0.*",
"thetwelvelabs/foursquare": "dev-master@dev",
"hybridauth/hybridauth": "*",
"caouecs/laravel4-lang": "*",
"phpoffice/phpexcel": "*",
"google/apiclient": "*"
},
"autoload": {
...
},
"scripts": {
...
},
"config": {
"preferred-install": "dist"
},
"minimum-stability": "dev"
}
编辑2:这是我的deploy.sh(在推送到Azure上的Repo成功后执行):
#!/bin/bash
# ----------------------
# KUDU Deployment Script
# Version: 0.2.2
# ----------------------
# Helpers
# -------
exitWithMessageOnError () {
if [ ! $? -eq 0 ]; then
echo "An error has occurred during web site deployment."
echo $1
exit 1
fi
}
# Prerequisites
# -------------
# Verify node.js installed
hash node 2>/dev/null
exitWithMessageOnError "Missing node.js executable, please install node.js, if already installed make sure it can be reached from current environment."
# Setup
# -----
SCRIPT_DIR="${BASH_SOURCE[0]%\\*}"
SCRIPT_DIR="${SCRIPT_DIR%/*}"
ARTIFACTS=$SCRIPT_DIR/../artifacts
KUDU_SYNC_CMD=${KUDU_SYNC_CMD//\"}
if [[ ! -n "$DEPLOYMENT_SOURCE" ]]; then
DEPLOYMENT_SOURCE=$SCRIPT_DIR
fi
if [[ ! -n "$NEXT_MANIFEST_PATH" ]]; then
NEXT_MANIFEST_PATH=$ARTIFACTS/manifest
if [[ ! -n "$PREVIOUS_MANIFEST_PATH" ]]; then
PREVIOUS_MANIFEST_PATH=$NEXT_MANIFEST_PATH
fi
fi
if [[ ! -n "$DEPLOYMENT_TARGET" ]]; then
DEPLOYMENT_TARGET=$ARTIFACTS/wwwroot
else
KUDU_SERVICE=true
fi
if [[ ! -n "$KUDU_SYNC_CMD" ]]; then
# Install kudu sync
echo Installing Kudu Sync
npm install kudusync -g --silent
exitWithMessageOnError "npm failed"
if [[ ! -n "$KUDU_SERVICE" ]]; then
# In case we are running locally this is the correct location of kuduSync
KUDU_SYNC_CMD=kuduSync
else
# In case we are running on kudu service this is the correct location of kuduSync
KUDU_SYNC_CMD=$APPDATA/npm/node_modules/kuduSync/bin/kuduSync
fi
fi
##################################################################################################################################
# Download Composer
# ----------
echo Downloading Composer
curl -sS https://getcomposer.org/installer | php
##################################################################################################################################
# Deployment
# ----------
echo "Switching to Maintenance Mode"
cd $DEPLOYMENT_TARGET
php artisan down
exitWithMessageOnError "Failed to turn maintenance on (php artisan down)"
echo Handling Basic Web Site deployment.
# 1. KuduSync
if [[ "$IN_PLACE_DEPLOYMENT" -ne "1" ]]; then
"$KUDU_SYNC_CMD" -v 50 -f "$DEPLOYMENT_SOURCE" -t "$DEPLOYMENT_TARGET" -n "$NEXT_MANIFEST_PATH" -p "$PREVIOUS_MANIFEST_PATH" -i ".git;.hg;.deployment;deploy.sh"
exitWithMessageOnError "Kudu Sync failed"
fi
##################################################################################################################################
# Dependency install
# ----------
# Invoke Composer in the deployment directory
echo Invoking composer install in deployment directory $DEPLOYMENT_TARGET
cd $DEPLOYMENT_TARGET
php $DEPLOYMENT_TARGET/composer.phar install -v --prefer-dist --no-dev --optimize-autoloader --no-interaction
echo Deleting all active Sessions
rm -f $DEPLOYMENT_TARGET/app/storage/sessions/*
echo Deleted all active Sessions
echo Clearing the cache
rm -f $DEPLOYMENT_TARGET/app/storage/cache/*
echo Cache Cleared
##################################################################################################################################
# Post deployment stub
if [[ -n "$POST_DEPLOYMENT_ACTION" ]]; then
POST_DEPLOYMENT_ACTION=${POST_DEPLOYMENT_ACTION//\"}
cd "${POST_DEPLOYMENT_ACTION_DIR%\\*}"
"$POST_DEPLOYMENT_ACTION"
exitWithMessageOnError "post deployment action failed"
fi
echo "Turning off Maintenance Mode"
cd $DEPLOYMENT_TARGET
php artisan up
exitWithMessageOnError "Failed to turn maintenance off (php artisan up)"
echo "Finished successfully."
答案 0 :(得分:0)
我使用您提供的详细信息尝试了git部署。它对我来说有以下变化
您的部署脚本引用了artisan文件。我不得不删除以下行
<强> deploy.sh 强>
php artisan down
php artisan up
我在 package.json
中没有您的脚本/自动加载详细信息 "autoload": {
...
},
"scripts": {
...
},
查看以上配置更改并检查是否可以解决您的问题。