Server for PHP icon

Server for PHP

在菜单栏一键启动、停止、重启 PHP Web 服务器,本地快速预览网页项目

Start, stop, and restart PHP's built-in web server right from your menu bar to preview PHP projects locally

核心功能

Features

一键启停

One-Click Control

菜单栏点击即可启动、停止、重启 PHP 服务(默认端口 8000)。

Start, stop, or restart PHP's built-in server with a single click from the menu bar (default port 8000).

端口自动避让

Port Auto-Avoidance

优先使用配置文件中用户指定的端口;若该端口被占用,自动从操作系统获取一个随机空闲端口,无需手动干预。

Prefer the user-specified port in the config file. If it is occupied, automatically allocate a random free port from the OS — no manual intervention needed.

仅本地访问

Local Access Only

默认开启,仅允许本机访问;可关闭限制可供局域网设备访问,点击后服务自动重启生效。

Enabled by default, restricting connections to localhost (127.0.0.1); disable to allow LAN access — the service restarts automatically to apply.

开机自启动 & 实时状态指示

Launch at Login & Live Status

支持开机后自动启动应用,保持 PHP 服务器随时可用。菜单栏图标通过透明度直观显示服务运行状态。

Automatically launch the app when you log in to macOS so the PHP server is always ready. The menu bar icon visually reflects the running state through opacity.

一键复制访问地址

Copy Access URL

点击菜单栏端口项,即可复制 http://127.0.0.1:XXXXX 访问地址。

Click the port item to copy the http://127.0.0.1:XXXXX access URL.

工作目录快捷访问

Working Directory Access

一键打开包含 php.ini、php.pid 与日志的工作目录。

Quickly open the working directory containing php.ini, php.pid, and logs.

Web Root 管理

Web Root Management

一键选择网页目录。使用安全书签持久化授权,重启后无感恢复。

Open the web root directory in Finder in one click; the menu item is disabled when no web root is set.

无数据收集

No Data Collection

完全在本地运行,不连接任何远程服务器,不收集任何用户数据。

Runs entirely on your machine. No remote servers, no data collection.

使用方式

How to Use

点击菜单栏中的应用图标打开菜单
点击 Start 启动 PHP 服务(首次启动自动创建配置 / 日志目录)
点击 Stop 停止服务,Restart 重启服务
点击 Port: XXXXX 复制 http://127.0.0.1:XXXXX 访问地址
通过 Select Web Root… 选择网页根目录,Open Web Root 可在文件管理器中打开
开启 Local Access Only 限制仅本机访问(默认开启)
Click the app icon in the menu bar to open the menu
Click Start to launch PHP's built-in server (first launch auto-creates config / log folders)
Click Stop to stop, Restart to restart
Click Port: XXXXX to copy the http://127.0.0.1:XXXXX URL
Use Select Web Root… to choose your web root; Open Web Root opens it in Finder
Enable Local Access Only to restrict to localhost (enabled by default)

常见问题

FAQ

PHP 服务无法启动?
退出程序后,通过 Working Directory 打开工作目录,删除Server for PHP 文件夹(注意备份配置文件和日志),然后重启程序,或者查看 logs/ 下的日志确认具体原因。
连接被拒绝?
确认服务已启动,检查浏览器访问的端口是否与菜单中显示的端口项一致,确认 Local Access Only 状态是否与当前所需的访问状态一致,确认防火墙是否允许该端口的访问。
实际端口与我配置文件里的不一样?
配置文件中的端口被占用时,应用会临时切换到下一个可用端口(菜单中端口前会出现 ⚠ 告警),下次重新启动仍会优先尝试您配置的端口。如需使用配置文件中的端口访问,请先确定配置文件中的端口是否被占用,解决端口占用问题之后重启软件即可。
如何设置网页根目录(Web Root)?
点击菜单中的 Select Web Root…,在弹出的文件夹选择器中选择你的网站根目录。选择后若服务正在运行会自动重启生效。路径通过安全书签持久化,重启应用后无需重新选择。
Open Web Root 为什么是灰色的?
说明尚未设置网页根目录。请先点击 Select Web Root… 选择一个网站根目录即可。
开启 Local Access Only 后局域网其他设备无法连接?
这是预期行为,该选项仅允许本机 127.0.0.1 访问。如需局域网访问,请关闭该选项,服务会自动重启并绑定 0.0.0.0。
PHP server won't start?
Check whether a port near 8000 is already in use — the app auto-avoids. Also inspect the logs under logs/ via the Working Directory for the exact reason.
Connection refused?
Make sure the service is running (icon is fully opaque) and the port you are accessing in the browser matches the finalPort shown in the menu bar.
Why is the actual port different from what's in my config file?
When your configured port is occupied, the app temporarily switches to the next free one (a ⚠ appears before Port in the menu). This is never written back to php.ini — the next launch will still prefer your configured port first.
How do I set the Web Root?
Click Select Web Root… in the menu and pick your PHP project folder. If the service is running, it restarts automatically; if not, the new root takes effect on the next start. The path is persisted via a Security-Scoped Bookmark, so you won't need to reselect it after restarting the app.
Why is Open Web Root grayed out?
It means no web root has been set yet. Click Select Web Root… to choose a folder first, then Open Web Root will open it in Finder.