Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to execute "php artisan migrate" and other Laravel commands in remote server?

I'm using Laravel 4.2 in remote server and I want to execute Laravel commands php artisan migrate but I don't know how.

like image 671
Youssef Had Avatar asked Sep 14 '14 21:09

Youssef Had


1 Answers

You can ssh to the server and perform the command, you can add your servers public key to the remote server to do this without a password. I made a bash script with the following code which I can then execute manually via command line or from a program, lets say I call it myscript.sh with the following code

ssh [email protected] << EOF
cd /var/www/app/;
php artisan migrate --force; // force prevents artisan from asking for a yes/no on production
exit;
EOF

now I can write 'sh myscript.sh' and it will run migrations on the remote server.

like image 77
Matkey Avatar answered Sep 22 '22 18:09

Matkey