skip to Main Content

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


  1. Chosen as BEST ANSWER

    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.

    1. remove the down file in storage/framework path
    2. then run this function Artisan::call('up')

    Every thing would be perfect.


  2. 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 request

    the --secret can be any string you want:

    Route::get('/shotdown_website', function () {
        Artisan::call('down',['--secret'=>'630542a-246b']);
        return "Website Down successfully";
    });
    
    

    then to access the server as admin you need to send this requet. the secret parameter is token you set in the above code:

    https://example.com/secret
    
    

    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

    Route::get('/Turn_Up_Desk2929/', function () {
        Artisan::call('up');
        return "Website Up successfully";
    }); 
    
    Login or Signup to reply.
  3. 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 .

    use IlluminateSupportFacadesArtisan;
    
    class AppServiceProvider extends ServiceProvider
    {
     public function boot()
        {
            Artisan::call('up');
            //
        }
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search