在Mac OS X上启动服务器

use*_*344 23 php macos server

我正在弄清楚如何使用PHP OpenId

我已将repo克隆到~/www目录中.php-open-id/examples目录中有一些我想运行的例子.

具体来说,我想渲染页面php-open-id/examples/consumer/index.php以便更好地理解API.我在php-open-id/examples目录中启动了一个服务器

python -m SimpleHTTPServer 8000
Run Code Online (Sandbox Code Playgroud)

我导航到了 localhost://consumer/index.php

但它没有用.它显示一个用于保存文件的对话框.呈现此PHP文件的正确方法是什么?

use*_*344 73

我找到了一个解决方案:

使用运行服务器

php -S localhost:9000
Run Code Online (Sandbox Code Playgroud)


abh*_*sen 11

苹果系统

只需访问您的项目文件夹

在该文件夹上打开终端

并运行 php -S localhost:9000

然后你就可以看到

PHP 7.3.24-(to be removed in future macOS) Development Server started at Tue Mar 30 11:58:49 2021
Listening on http://localhost:9000
Run Code Online (Sandbox Code Playgroud)

之后,如果您的端口不可用,您就可以在 http://localhost:9000 上访问您的应用程序,请尝试更改端口