Command to leave running Laravel 5.1

Asked

Viewed 1,050 times

0

I have an Laravel 5.1 facility To start, I’m using:

php Artisan serve --host=meudominio.com.br --port=8001

I have tried to include & (Commercial) at the end, with space, but after executing this command, it remains running on the Ubuntu terminal, which is not feasible. (Demonstrative image) inserir a descrição da imagem aqui

I need to leave my project running without the need to follow in the terminal with the artisan serve , I read about this, that you can run the php command but in the background , without the request screen appearing, saving in some kind of log.

Can someone help me with the command?

2 answers

1

To get you to run a background command on linux there are several ways to do this, among them being the "nohup" command available on UNIX systems, it allows you to run program in a "disconnected" way from the current session. That is, if the user logs out, the command will continue to run in the background, sending its output to the file "nohup.out" which will be created in the current directory (where the command was executed), but you can also run the programs in silent mode (You will not create the nohup.out file in the directory).

nohup php artisan serve >/dev/null 2>&1 & # Não criará o arquivo nohup.out no diretório

nohup php artisan serve & # Criará o arquivo nohup.out no diretório

1

According to Laravel’s documentation:

Typically, you may use a web server such as Apache or Nginx to serve your Laravel Applications. If you are on PHP 5.4+ and would like to use PHP’s built-in Development server, you may use the serve Artisan command... Here

This feature is intended for the development version. The version of the system that is actually in use, is preferable that it is running on a WEB server, like apache, Nginx and others. The text is not as clear as this restriction, only gives the option to a development server running directly in PHP. However, it is much more likely that a web server will perform much better with user requests (because there are years of optimizations) than the script that is provided along with the framework.

If you still want to run the application without a "hidden terminal". You can try these settings (I do not recommend):

ignore_user_abort(1); 
set_time_limit(0);

Browser other questions tagged

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