Daily Archives: September 9, 2013

How to run Yii Migrations on Linux

After developing an application on a windows box using “php yiic migrate”, I found this did not work on Linux. I received an error “yiic command not found” and also “php command not found”. Both of these executable’s need to be added to your linux user’s PATH, which is a bunch of directories that linux will search through to find executable files. Here is a great resource on working with the PATH http://www.troubleshooters.com/linux/prepostpath.htm. To make “php yiic migrate” work I added the below line to the /etc/profile file, which provides the directory to the php executable on the machine along with the location of your migrations directory. The connection/session may need to be closed and reopened for it to take effect.

export PATH=$PATH:/usr/local/bin:/var/www/youryiisitedirectory/protected

Now when you navigate to the migrations directory, you can run “php yiic migrate” as usual.