How to deploy PHP (laravel) Application on Azure App services ? (Lower version of PHP)

Rahul 236 Reputation points
2020-03-17T16:37:45.083+00:00

Hi Team,

I need to deploy PHP(Laravel) application to Azure App Service.

Environment: Azure App Service (Linux) platform, Azure MySQL.

I'm referring to this documentation. (https://learn.microsoft.com/en-us/azure/app-service/app-service-web-tutorial-php-mysql)

Issue:

  1. What is the minimum Version of PHP supported by Azure App Service ? And how to set the version ? Reason I'm asking is because application supports only this version (PHP >= 5.4, PHP < 7). In Portal I'm not getting the option to set it less than 7
  2. How to set Virtual path for PHP Laravel Application in Azure ? I'm not able to understand this statement "In the Cloud Shell, set the virtual application path by using the az resource update command. Replace the <appname> placeholder." az resource update --name web --resource-group myResourceGroup --namespace Microsoft.Web --resource-type config --parent sites/<app_name> --set properties.virtualApplications[0].physicalPath="site\wwwroot\public" --api-version 2015-06-01 Reference: https://learn.microsoft.com/en-us/azure/app-service/app-service-web-tutorial-php-mysql#set-the-virtual-application-path
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,831 questions
{count} votes

Accepted answer
  1. Grace MacJones - MSFT 91 Reputation points
    2020-03-19T08:13:04.053+00:00

    Hi Rahul,

    The minimum PHP version supported on App Service is 7.3 .

    The Laravel application, uses the /public subdirectory as the site root. The default PHP Docker image for App Service uses Apache, and it doesn't let you customize the DocumentRoot for Laravel. However, you can use .htaccess to rewrite all requests to point to /public instead of the root directory. In the repository root, an .htaccess is added already for this purpose. With it, your Laravel application is ready to be deployed.

    However, if you wish to change the site root, you can update the .htaccess file in your repository root with the following content:

      <IfModule mod_rewrite.c>  
            RewriteEngine on  
          
            RewriteRule ^.*$ /public/$1 [NC,L,QSA]  
        </IfModule>  
    

    Hope that helps. please let us know if you have further questions.

    Thanks,
    Grace

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful