Yii2: A Guide on How to Migrate Databases Using PHP

To migrate, incorporate the following (substitute “change” with the designated connection name in the configuration files): Solution 1 involves running a command in the project directory to apply migrations to the Yii2 test database. As for Solution 3, it employs a custom implementation that eliminates all tables in the proper sequence instead of using migrations to clean up the database.


It’s probable that there are multiple PHP versions available, and the console runner is utilizing

/usr/bin/env php


  • /usr/bin/env php requirements.php

  • /usr/bin/env php -m | grep -i pdo

Frequently Asked Questions

Posted in Php