I want to upload and make some changes on my website, so by calling the below code, I tried to down the laravel server:
Web.php:
Route::get('/shotdown_website', function () {
Artisan::call('down');
return "Website Down successfully";
});
Unfortunately, I couldn’t get up the server again.
Route::get('/Turn_Up_Desk2929', function () {
Artisan::call('up');
return "Website Up successfully";
});
when I write mywebsite/Turn_Up_Desk2929
in the browser address bar, it redirects me to the error server page which is 503.
Overall, in the first step, I downed the server but in the second part, I could not up the server again. Additionally, in the PHPstorm terminal, I had not any issues.
Thanks.
3
Answers
Finally, I can find the answer:
As my website is uploaded on a shared host, so accessing CLI or terminal has been banned, but, there is an easy way for rescuing from the downing website.
down
file instorage/framework
pathArtisan::call('up')
Every thing would be perfect.
that’s because of server is down and you can not make any request even request that make server up.
so if you want to make server up using request then you need to define a
secret
when making server down and send the secret with up requestthe
--secret
can be any string you want:then to access the server as admin you need to send this requet. the secret parameter is token you set in the above code:
in this way a cookie will be created that determine you are admin and can create any request .
so you can call the below route
you can run
Artisan::call('up')
in a provider files like AppServiceProvider.this file is renderd in any condition even when application is in maintenance mode . then create any request .