dow5001 2018-10-06 16:39
浏览 111

我无法运行PHP Artisan Server

I was trying to run my public site on my local computer.

It's done in Laravel 5.

I get the following error:

chdir error (): No such file or directory (errno 2)

I did what I saw in this post:

laravel5: chdir(): No such file or directory (errno 2)

I run the PHP Artisan server again, but now it shows me this:

Warning: require_once (C: \ Users \ wacks \ Desktop \ TEC \ webtec / public / index.php): failed to open stream: No such file or directory in C: \ Users \ wacks \ Desktop \ TEC \ webtec \ server.php on line 21

Fatal error: require_once (): Failed opening required 'C: \ Users \ wacks \ Desktop \ TEC \ webtec / public / index.php' (include_path = 'C: \ xampp_1 \ php \ PEAR') in C: \ Users \ wacks \ Desktop \ TEC \ webtec \ server.php on line 21

Here is my code:

serve.php

 namespace App\Console\Commands;

 use Exception;
 use Illuminate\Console\Command;
 use Symfony\Component\Console\Input\InputOption;
 use Symfony\Component\Process\PhpExecutableFinder;
 use Symfony\Component\Process\ProcessUtils;

 class Serve extends Command {
/**
 * The console command name.
 *
 * @var string
 */
protected $name = 'serve';

/**
 * The console command description.
 *
 * @var string
 */
protected $description = 'Serve the application on the PHP development server';

/**
 * Execute the console command.
 *
 * @return void
 *
 * @throws \Exception
 */
public function fire() {
    chdir('/');

    $host = $this->input->getOption('host');

    $port = $this->input->getOption('port');

    $base = ProcessUtils::escapeArgument($this->laravel->basePath());

    $binary = ProcessUtils::escapeArgument((new PhpExecutableFinder)->find(false));

    $this->info("Laravel development server started on http://{$host}:{$port}/");

    if (defined('HHVM_VERSION')) {
        if (version_compare(HHVM_VERSION, '3.8.0') >= 0) {
            passthru("{$binary} -m server -v Server.Type=proxygen -v Server.SourceRoot={$base}/ -v Server.IP={$host} -v Server.Port={$port} -v Server.DefaultDocument=server.php -v Server.ErrorDocument404=server.php");
        } else {
            throw new Exception("HHVM's built-in server requires HHVM >= 3.8.0.");
        }
    } else {
        passthru("{$binary} -S {$host}:{$port} {$base}/server.php");
    }
}

/**
 * Get the console command options.
 *
 * @return array
 */
protected function getOptions() {
    return [
        ['host', null, InputOption::VALUE_OPTIONAL, 'The host address to serve the application on.', 'localhost'],

        ['port', null, InputOption::VALUE_OPTIONAL, 'The port to serve the application on.', 8000],
    ];
}
 }

kerner.php

 <?php

 namespace App\Console;

 use Illuminate\Console\Scheduling\Schedule;
 use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

 class Kernel extends ConsoleKernel {
/**
 * The Artisan commands provided by your application.
 *
 * @var array
 */
protected $commands = [
    // Commands\Inspire::class,
    Commands\Serve::class,
];

/**
 * Define the application's command schedule.
 *
 * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
 * @return void
 */
protected function schedule(Schedule $schedule) {
    // $schedule->command('inspire')
    //  ->hourly();
}
 }

webtec\server.php

 <?php

 /**
  * Laravel - A PHP Framework For Web Artisans
  *
  * @package  Laravel
  * @author   Taylor Otwell <taylor@laravel.com>
  */

 $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';

Could someone help me with this?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 请问下这个红框里面是什么文档或者记事本编辑器
    • ¥15 机器学习教材中的例题询问
    • ¥15 求.net core 几款免费的pdf编辑器
    • ¥15 为什么安装HCL 和virtualbox之后没有找到VirtualBoxHost-OnlyNetWork?
    • ¥15 C# P/Invoke的效率问题
    • ¥20 thinkphp适配人大金仓问题
    • ¥20 Oracle替换.dbf文件后无法连接,如何解决?(相关搜索:数据库|死循环)
    • ¥15 数据库数据成问号了,前台查询正常,数据库查询是?号
    • ¥15 算法使用了tf-idf,用手肘图确定k值确定不了,第四轮廓系数又太小才有0.006088746097507285,如何解决?(相关搜索:数据处理)
    • ¥15 彩灯控制电路,会的加我QQ1482956179