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

dennis.c's avatar

Problem in running in digital ocean server laravel 7.3

Getting this error while running in digital ocean server, not sure why. Can anyone help?

Illuminate\Contracts\Container\BindingResolutionException Target class [Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull] does not exist.

0 likes
10 replies
dennis.c's avatar
  • @var array */ protected $middleware = [ // \App\Http\Middleware\TrustHosts::class, \App\Http\Middleware\TrustProxies::class, \Fruitcake\Cors\HandleCors::class, \App\Http\Middleware\CheckForMaintenanceMode::class, \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class, \App\Http\Middleware\TrimStrings::class, \App\Http\Middleware\ConvertEmptyStringsToNull::class, ];

@wakanda

dennis.c's avatar
 * @throws \Illuminate\Contracts\Container\BindingResolutionException

 */

public function build($concrete)

{

    // If the concrete type is actually a Closure, we will just execute it and

    // hand back the results of the functions, which allows functions to be

    // used as resolvers for more fine-tuned resolution of these objects.

    if ($concrete instanceof Closure) {

        return $concrete($this, $this->getLastParameterOverride());

    }



    try {

        $reflector = new ReflectionClass($concrete);

    } catch (ReflectionException $e) {

        throw new BindingResolutionException("Target class [$concrete] does not exist.", 0, $e);

    }



    // If the type is not instantiable, the developer is attempting to resolve

    // an abstract type such as an Interface or Abstract Class and there is

    // no binding registered for the abstractions so we need to bail out.

    if (! $reflector->isInstantiable()) {

        return $this->notInstantiable($concrete);

    }



    $this->buildStack[] = $concrete;



    $constructor = $reflector->getConstructor();



    // If there are no constructors, that means there are no dependencies then

    // we can just resolve the instances of the objects right away, without
Snapey's avatar

how did you deploy your project?

Snapey's avatar

run composer dump just to be sure

dennis.c's avatar

Let me try this and get back to you in 2 mins

Please or to participate in this conversation.