Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

example 02-views doesn't work on php -S server #5

Open
Meleeman01 opened this issue Mar 28, 2022 · 1 comment
Open

example 02-views doesn't work on php -S server #5

Meleeman01 opened this issue Mar 28, 2022 · 1 comment

Comments

@Meleeman01
Copy link

Meleeman01 commented Mar 28, 2022

https://github.com/riverside/php-express/blob/master/examples/02-views/index.php

it will only show the root route, and the link to the next page is broken. i've been using php7.3 dev server to test the examples.

@SpiffGreen
Copy link

For php -S server you'd have to specify the php file to run, say something like:
index.php

<?php
  require 'vendor/autoload.php';
  
  // Fix
  $_SERVER['REQUEST_SCHEME'] = 'http';

  $app = new \PhpExpress\Application();

  $app->get('/', function($req, $res)  {
    $res->send([
      "status" => "success",
      "message" => "API is working fine"
    ]);
  });

  $app->run();

You'd have to run it like this php -S localhost:5000 index.php

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants