gpt4 book ai didi

php - windows环境下如何通过PHP连接远程Linux box

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:06:50 25 4
gpt4 key购买 nike

我在一台安装了 Wamp 的 Windows XP 机器上。目前,我正在使用 putty 连接我的远程 Linux 机器。

我想通过 php shell_exec() 方法(cp, ls, ...)执行 Linux 命令。

有人知道如何先连接我的 Linux 机器,然后在 Windows 环境中运行这些命令吗?

任何建议都将不胜感激...

最佳答案

您不能在 Windows 中运行 Linux 命令。您可以使用 putty 通过 SSH 运行它们。看来您正在运行。

您可以通过 ssh 转发连接。查看 Putty 屏幕,转到 Connection > SSH > Tunnels

然后你添加一个隧道:

source port: 1234 
destination port: localhost:80
type is Local

所以你打开 Internet Explorer,在地址栏中输入:http://localhost:1234 然后端口 1234 被转发到远程 Linux PC 上的端口 80

也可以通过设置转发到WAMP

destination port: *ip of the wamp server*:80

然后,只要putty 正在运行,您就可以从网络外部访问Windows 电脑。

关于php - windows环境下如何通过PHP连接远程Linux box,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12160937/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com