php - 使用自动 URL 在代理下执行 php 命令。
问题描述
首先,我会要求你尽可能清楚,我在这方面还很初级,有些概念对我来说仍然很难。我也会尽可能清楚。所以这里是交易。我在具有用户身份验证的代理下工作,我无法禁用它。我可以直接下载程序,但控制台是另一回事。我正在尝试使用 php 命令安装 symfony 3.4:
php -r "file_put_contents('symfony', file_get_contents('https://symfony.com/installer'));
Php(7.1.23)似乎工作正常(php -version 返回 ok)我已经设置了全局变量 https_proxy 和 http_proxy(我的代理正在使用非安全协议,但我已经将两者设置为相同的方向 http :// ....Accelerated_pac_base.pac)。以防万一。在我的所有浏览器中都正确配置了代理,没有任何问题。
到目前为止,我已经达到的最接近的方法是直接在 cmd 中编码(来自代理的服务器从 .pac 文件中提取服务器端口),代码如下:
php -r "file_put_contents('symfony',file_get_contents('https://symfony.com/installer',False, stream_context_create(['proxy' => 'my_proxy_server:80', 'request_fulluri' => true,'header'=> 'Proxy-Authorization: Basic '.base64_encode('my_proxy_user:my_proxy_password')])));"
这显示了一些带有错误的警告,例如
PHP Warning : stream_context_creat(): options should have the form ["wrappername"]["optionname"] = $value in Command line code on line 1
Warning : stream_context_creat(): options should have the form ["wrappername"]["optionname"] = $value in Command line code on line 1
PHP Warning : file_get_contents(): php_network_getaddresses : getaddrinfo failed : (error in spanish which i translated into: "This is usually a temporary eror during host name resolution meaning local server didnt got an answer from an authoritative server") In Command line code on line 1.
Warning : file_get_contents(): php_network_getaddresses : getaddrinfo failed : (error in spanish which i translated into: "This is usually a temporary eror during host name resolution meaning local server didnt got an answer from an authoritative server") In Command line code on line 1.
PHP Warning : file_put_contents (symfony): failed to open stream: Permission denied in Command line code on line 1
PHP Warning : file_put_contents (symfony): failed to open stream: Permission denied in Command line code on line 1
顺便说一句重复的错误(我不知道是否正常或可能意味着什么)还尝试更改服务器端口的自动 URL,没有服务器设置,使用一些安装程序......似乎没有任何工作我有这个 symfony 问题和与作曲家。非常感谢修复我的代码或一些不同的方法。如果您需要更多信息,请告诉我,我正在使用 Windows 10,并且我发布的代码没有语法错误。
谢谢你的帮助!
解决方案
推荐阅读
- sql - 将 SQL 中带小数点时间戳的 17 位数字转换为日期
- python - 如何识别pandas python中的列值变化
- ios - '尝试将第 0 行插入第 0 节,但更新后第 0 节只有 0 行'
- reactjs - 组内的导入源必须按字母顺序排列。打字稿
- doctrine - Doctrine 多对一多目标实体
- c# - Blazor 项目中的反序列化问题
- android - 使用 If 条件测试来自 toast 消息
- windows - 威胁服务已停止
- javascript - 在 JavaScript 的 if 语句中使用不带括号的函数名有什么作用?
- macos - MTKView 委托停止响应 - (void)drawInMTKView:(nonnull MTKView *)view 调用