I\'m using hosting in linux and configured subdomain in my website in Apache2 server. I\'m using laravel but I didn\'t use apache2 service by default. I\'m using laravel artisan
I know this is an old question, but I was having the same problem and I found a solution by adding a server.php
file to the root directory of the project with the following content:
<?php
$uri = urldecode(
parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)
);
// This file allows us to emulate Apache's "mod_rewrite" functionality from the
// built-in PHP web server. This provides a convenient way to test a Laravel
// application without having installed a "real" web server software here.
if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri))
{
return false;
}
require_once __DIR__.'/public/index.php';
I had the same issue, the real cause of the problem is this, somewhere along the line, the last parameter for the php -S
built in server was changed to a flag, so you have to call it like this:
php -S 127.0.0.1:8000 -t public -f serve.php
Before php 7.0.26 you could omit the -f
.
This is what happens under the hood when you call php artisan serve
.
If you want to serve it with php artisan serve
you will have to override the ServeCommand
and add -f
before the serve.php
ont the last line of the fire()
method, like this:
passthru('"'.PHP_BINARY.'"'." -S {$host}:{$port} -t \"{$public}\" -f server.php");
For more details look at this stackoverflow post.