database migration on shared hosting without console

(Rocky79) #1

I can run database migration on local with command "yiic migrate"

Can I run database migration on shared hosting if I only access to FTP but no console ?

Thank you.

(Maurizio Domba Cerin) #2

Think about it…

can you run any command when you connect with FTP (other than FTP commands ofcourse)?

(Rocky79) #3

I dont think so

so I cannot use yii on this kind of hosting ?


(Jacob Moen) #4

Of course you can: just run a php script - I am using Yii on a shared host with no shell.

(Rocky79) #5

May I ask how to write the migrate php script ?


(Alexander Makarov) #6

Also you can try using my webshell extension:

(Rocky79) #7

Got it. It works.

Thanks you all!

(Jacob Moen) #8

This works too:


$cmd = "./protected/yiic migrate --interactive=0";

$output = stream_get_contents(popen($cmd, 'r'));

echo $output;

I just tested it - I need to run this from an installer I’m coding.

(Dustbin1uk) #9

Just wanted to say thanks for this thread, just saved me a ton of hassle. :)