Migrate Yii Framework Application to Azure Web App

1 minute read | By Yi Wang

1. Create a PHP Empty Web App on Azure:



2. Copy the contents from Yii framework application root to wwwroot, e.g.


   Note: In this example, framework and application (assets, themes, index.php, etc.) are all in wwwroot.

3. Turn on error log, so that you can watch for errors in php_errors.log during migration:

    If log_errors is default to “Off”, create a .user.ini file in wwwroot, add this line in .user.ini:


4. Modify database connection criteria from main.php (in this demo, it is protected/config/main.php), link to right database.

5. If you have hiding index.php implemented, configure it in web.config (create web.config file under wwwroot if it is not there), add rewriting rules. Here is sample web.config:

<?xml version="1.0" encoding="UTF-8"?>





    <!--# otherwise forward it to index.php-->

    <rule name="Imported Rule 1">

      <match url="." ignoreCase="false" />


        <!--# if a directory or a file exists, use it directly-->

        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />

        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />


      <action type="Rewrite" url="index.php" />






6. Check index.php, validate the paths for $yii and $config. If you included any php functions, validate file path as well.

    Test your site .azurewebsites.net, it should point to site home page, e.g.