Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Updated local_server_start.go to display the correct listening IP in …#589

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
lmlsna wants to merge3 commits intosymfony-cli:main
base:main
Choose a base branch
Loading
fromlmlsna:patch-1

Conversation

@lmlsna
Copy link

…print statement

When starting the local server using theserver:start orlocal:server:start commands, a console success message is printed that displays the PHP version, port, and listening IP address.

The address that is printed is hard-coded to display 127.0.0.1. The--listen-ip option allows the listening IP to be set to any IP the interface has, and the--allow-all-ip option effectively sets the listening IP to the "all IPs" address (0.0.0.0 for IPv4 and [::] for IPv6).

This change creates anaddress variable that is equal to the--listen-ip option value (which defaults to 127.0.0.1 if not set) or 0.0.0.0 if--allow-all-ip is passed.

The corrected debug statement makes it clear that these options were correctly applied by the user and eliminates the situation (that I experienced) where I believed the server was only listening on localhost and I was somehow not specifying the--listen-ip option correctly (until I callednetstat to check what IP it was actually listening on.

…print statementWhen starting the local server using the `server:start` or `local:server:start` commands, a console success message is printed that displays the PHP version, port, and listening IP address.The address that is printed is hard-coded to display 127.0.0.1. The `--listen-ip` option allows the listening IP to be set to any IP the interface has, and the `--allow-all-ip` option effectively sets the listening IP to the "all IPs" address (0.0.0.0 for IPv4 and [::] for IPv6).This change creates an `address` variable that is equal to the `--listen-ip` option value (which defaults to 127.0.0.1 if not set) or 0.0.0.0 if `--allow-all-ip` is passed.The corrected debug statement makes it clear that these options were correctly applied by the user and eliminates the situation (that I experienced) where I believed the server was only listening on localhost and I was somehow not specifying the `--listen-ip` option correctly (until I called `netstat` to check what IP it was actually listening on.
msg+=fmt.Sprintf(" The Web server is using %s %s\n",p.PHPServer.Version.ServerTypeName(),p.PHPServer.Version.Version)
}
msg+=fmt.Sprintf("\n <href=%s://127.0.0.1:%d>%s://127.0.0.1:%d</>",scheme,port,scheme,port)
msg+=fmt.Sprintf("\n <href=%s://%s:%d>%s://%s:%d</>",scheme,address,port,scheme,address,port)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

this implementation will show an unreachable address when the address is 0.0.0.0 so I’m wondering if we should not display a completely different message in such case.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Ah, true, this link would be broken, didn't even think of that.

Perhaps leave the href= set to localhost but display the 0.0.0.0 link text in such situations?
Alternatively, but a bit more complicated, use the host name/domain of the machine for the href= ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Using the hostname or domain seems fragile as they might not resolve to the IP selected by the user (and adds the complexity of discovering them for an edge case).

I believe it's best to use a different message or remove the link when we listen on all available IP.

(To be noted, we already show the domain names attached to the proxy)

lmlsnaand others added2 commitsMarch 24, 2025 22:40
(my bad)Co-authored-by: Tugdual Saunier <tucksaun@users.noreply.github.com>
Co-authored-by: Tugdual Saunier <tucksaun@users.noreply.github.com>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@tucksauntucksaunAwaiting requested review from tucksaun

1 more reviewer

@KocalKocalKocal left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@lmlsna@tucksaun@Kocal

[8]ページ先頭

©2009-2025 Movatter.jp