How to run php Artisan migrate on the web server

Asked

Viewed 862 times

0

I passed the project of Laravel 5.4 for hosting, but now I do not know a way to use the php Artisan migrate to create my tables in the database.

I created a file in the public folder named after installation php. with the following code:

<?php 
   // installation.php file
   echo exec('php /var/www/laravel-app/artisan migrate:install');

That way when accessed this file were automatically migrated my tables. I got the following return:

Warning: exec(): Unable to fork [php /home/MEU_ENDEREÇO/public_html/PROJETO/artisan migrate:install] in /home/MEU_ENDEREÇO/public_html/PROJETO/public/installation.php on line 3

I would like to know the ways I can perform such a procedure or to resolve this error.

Att. Thank you for your attention.

  • You can’t do that for ssh?

  • Sorry, I can’t do it that way :D

  • There must be some tutorial on your hosting service.

  • take a look at documentation of exec ( string $command [, array &$output [, int &$return_var ]] ) has two more parameters that Voce can use, $output is the return of the command, the output that Voce sees in the terminal, this will give you a better idea of what is happening.

  • Another problem that may be is that some hosts have PHP 5.2 installed, but with .htaccess enabling to run as 5.3, 5.4, etc. The problem with this is that when running the artisan by the command line, which is what the exec() does, will run as PHP 5.2 and therefore give a lot of error why the Laravel needs at least PHP 5.3, in which case I do not know if it has how to solve.

  • I contacted the hosting and asked to free the ssh access, from now on just run the commands of php Artisan. Thanks for the collaboration, it was of great help.

  • It could also export the bank on the local phpmyadmin and then import the phpmyadmin on its host

Show 2 more comments

1 answer

0


I contacted my hosting and enabled ssh, after which it was only necessary to execute the commands of php Artisan that everything worked perfectly.

I thank everyone who collaborated and @Anderson Carlos Woss who commented on the ssh of hosting

Browser other questions tagged

You are not signed in. Login or sign up in order to post.