0

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?

Salman Malik
  • 923
  • 6
  • 24
  • Apply this StackOverflow question solutions: [Php Artisan serve command not serving Laravel](https://stackoverflow.com/questions/55290052/php-artisan-serve-command-not-serving-laravel-5-8) – Faizan Ali Oct 11 '21 at 13:20
  • Nope, this ended up generating another error ```The requested resource / was not found on this server.``` – Salman Malik Oct 11 '21 at 13:37
  • Does this answer your question? [Php Artisan serve command not serving Laravel 5.8](https://stackoverflow.com/questions/55290052/php-artisan-serve-command-not-serving-laravel-5-8) – Kaushik Thakkar Oct 11 '21 at 14:40
  • @KaushikThakkar , Faizan already suggested this. – Salman Malik Oct 11 '21 at 15:17

0 Answers0