Laravel App running on xampp but not with artisan serve

420 Views Asked by At

I am trying to run my app via php artisan serve on PHPStorm IDE but it throws some error that I am unable to understand, When running it via xampp on apache it works like a charm but as soon as I initiate it with php artisan serve it halts then an there. Here's the error I get:

Warning: require_once(H:\University Documents\UMT\F2021\FYP 2\Smart School System\smartschoolsystem/public/index.php): Failed to open stream: No such file or directory in H:\University Documents\UMT\F2021\FYP 2\Smart School System\smartschoolsystem\server.php on line 21

Fatal error: Uncaught Error: Failed opening required 'H:\University Documents\UMT\F2021\FYP 2\Smart School System\smartschoolsystem/public/index.php' (include_path='C:\xampp\php\PEAR') in H:\University Documents\UMT\F2021\FYP 2\Smart School System\smartschoolsystem\server.php:21 Stack trace: #0 {main} thrown in H:\University Documents\UMT\F2021\FYP 2\Smart School System\smartschoolsystem\server.php on line 21

here's my Server.php:

<?php

$uri = urldecode(
    parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)
);

if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) {
    return false;
}

require_once __DIR__.'/public/index.php';

AppServiceProvider.php

<?php 
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Builder;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        Builder::defaultStringLength(191);
    }

    public function register()
    {
        //
    }
}

I tried changing root at register() in AppServiceProvider but it ended up sending me to unreachable request, I also changed require_once __DIR__.'/public/index.php'; to require_once __DIR__.'/index.php'; in server.php it didn't work either. How do I resolve this?

0

There are 0 best solutions below