0

I am having an Azure app Service and I want to upload/deploy an .php file to it an run it right after the upload.

I managed to upload it via curl and also start a post deployment script. Unfortunately I can not use the command "php ..." in it because I get an error like: "/opt/Kudu/Scripts/starter.sh: line 2: exec: php: not found\n" in the logs. The same occurs if I use the "/api/command" endpoint with the same command. I get the same kind of error in the response.

It seems like the php executable is not known in that environment. Is there any way to run a php script via the command API or in a post deployment script?

EDIT for further clarification: I need curl because I want to run it automatically with a deployer which generates a php file which then does our specific deployment tasks (generating folders, symlinks and so on). So after I deploy that php file on the App service I need to start it. So far curl was the only opportunity I found which doesn't need a user interaction if done correctly. With right after the upload I mean after using one of the 2 SCM/Kudu apis which are "/api/zip/" or "api/zipdeploy/"

Thanks in advance

4
  • Please share more details - what do you mean by "right after the upload"? Why do you need cURL for this? Commented Jan 17, 2022 at 10:56
  • I need curl because I want to run it automatically with a deployer which generates a php file which then does our specific deployment tasks (generating folders, symlinks and so on). So after I deploy that php file on the App service I need to start it. So far curl was the only opportunity i found which doesnt need a user interaction if done correctly. With right after the upload i mean after using one of the 2 SCM/Kudu apis which are "/api/zip/" or "api/zipdeploy/ Commented Jan 18, 2022 at 9:19
  • Please add all clarification to your question by editing it Commented Jan 18, 2022 at 9:20
  • Please provide enough code so others can better understand or reproduce the problem. Commented Jan 26, 2022 at 10:47

1 Answer 1

0
  • You can use WebJob for running the scripts in Azure App Service Instance without any user interactions or which acts as background tasks.

  • Azure WebJobs SDK is to simplify many programming tasks.

  • The file types (scripts or programs) supported by Azure WebJobs SDK are : .cmd, .bat, .exe, .ps1, .sh .php, .py, .js, .jar

  • Just tweak your php script to have a loop and add a sleep of a few minutes between runs of your code.

  • The continuous WebJob will run on all of your instances and even if something fails it will be brought back up.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.