PHP 8.1 App Service Linux KUDU Deployment Script

seth 6 Reputation points
2022-12-16T13:35:11.34+00:00

Hi All,

Using GitHub Actions / KUDU deployment and have been unable to automate my php deployment actions. I am attempting to install composer using .phar but the deployment command errors indicate that it is unable to locate php.

When I was running on php 7.4, I created my deploy.sh based on the guides such as this one: https://learn.microsoft.com/en-us/azure/mysql/flexible-server/tutorial-php-database-app and everything was working. I have not been able to achieve this on php 8.1.

Error message:

Running composer install  
deploy.sh: line 120: /usr/local/bin/php: No such file or directory  
An error has occurred during web site deployment.  
composer failed  

I have tried this with and without the full path (or what I thought was the full path) to php.

Deployment command that is failing:

# 2. Install Composer modules  
if [ -e "$DEPLOYMENT_TARGET/composer.json" ]; then  
  echo Running composer install  
  cd "$DEPLOYMENT_TARGET"  
  eval /usr/local/bin/php composer.phar install --optimize-autoloader --no-dev  
  exitWithMessageOnError "composer failed"  
  cd - > /dev/null  
fi  

Using the advanced tools bash, I do not see php installed. Using SSH, it is.

Bash:

kudu_ssh_user@686a5aa765af:/$ php -v  
-bash: php: command not found  

SSH:

root@de42b3c23ae7:/home# php -v  
PHP 8.1.12 (cli) (built: Dec  2 2022 07:59:07) (NTS)  

Am I misunderstanding?

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,930 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Grmacjon-MSFT 19,151 Reputation points Moderator
    2023-03-02T03:19:36.2566667+00:00

    Hi seth,

    Apologies for the delay in response.

    Could you please share the appname so that we can take a look at complete deployment logs? Also is the deployment failing using github action only?
    When you say Kudu Deployment, which method(zip deployment or something else) was used? 

    You can email me the above infomation at [azcommunity@microsoft.com] with the subject ATTN: Grace and in the body of the email, include your Azure subscription ID and a link to this thread so we can further investigate this issue.

    We look forward to hearing from you.

    Thanks,
    Grace

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.