I have a new laravel 8 installation which I have changed the index directory to the based_path() directory.
That is the root folder of fresh laravel installation.
Now whenever I run
php artisan serve
It says that the $_SERVER['DOCUMENT_ROOT'] is the same as laravel public_path.
But when I use the default
php -S 127.0.0.1:8000
I got the document root as the base url and public_path()
as $_SERVER['DOCUMENT_ROOT']/public which is the way I want php artisan serve to be.
My question is how can I configure laravel to use the base_path() ie the index directory as the $_SERVER['DOCUMENT_ROOT']
When running php artisan serve.
I want the index directory to be $_SERVER['DOCUMENT_ROOT'] and the directory returned by public_path() to be $_SERVER['DOCUMENT_ROOT']/public.
This issue is only when running php artisan serve.
Everything else is working fine when using virtual host, or php -S localhost:8000.
If you can direct me to the file that is generating the $_SERVER['DOCUMENT_ROOT']
When
php artisan serve
is ran, I think the problem will be solved.