Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

amifidele's avatar

My laravel form is showing 500 server error on shared hosting

My laravel form is working correctly on localhost but when is on shared hosting its gives a server error,

please help me to get out of this.

see my code in CheckoutController.php :

 public function store(Request $request)
    {

        $order = Order::create([
            'user_id' => auth()->user() ? auth()->user()->id : null,
            'billing_email' => $request->email,
            'billing_phone' => $request->phone,
            'billing_name' => $request->name,
            'billing_name_on_card' => $request->name_on_card,
            'billing_city' => $request->city,
            'billing_time' => $request->created_at,
            'billing_subtotal' => $request->newSubtotal,
            'billing_tax' => $request->newTax,
            'billing_total' => $request->newTotal,
            'error' => null,

        ]);


        foreach(Cart::content() as $product){
            OrderProduct::create([
                'order_id' => $order->id,
                'product_id' => $product->model->id,
                'quantity' => $product->qty,
            ]);
        }

        
       Mail::send(new OrderPlaced($order));

        Cart::instance('default')->destroy();

      
        return redirect()->route('success');
    }

my routes web.php code :

Route::post('/checkout', 'CheckoutController@store')->name('checkout.store');

0 likes
6 replies
amifidele's avatar

@michaloravec That it!

[2020-05-20 08:10:12] local.ERROR: No Database connection yet in VoyagerServiceProvider loadAuth()  
[2020-05-20 08:10:12] local.ERROR: SQLSTATE[28000] [1045] Access denied for user 'admin'@'localhost' (using password: YES) {"exception":"[object] (Doctrine\DBAL\Driver\PDOException(code: 1045): SQLSTATE[28000] [1045] Access denied for user 'admin'@'localhost' (using password: YES) at /home/ihahoqaw/public_html/shop/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:31)
MichalOravec's avatar
Level 75

@amifidele So you don't have set your database, check credentials in .env on your production server and set it correctly.

Please or to participate in this conversation.