相关疑难解决方法(0)

无法包含远程服务器上的文件

我的问题是我无法在远程服务器上包含文件。

<?php
  echo "Including\n";
  require_once("http://xx.xxx.xxx.xx:8080/path/to/myfile.inc");
  echo "Done..\n";
?>
Run Code Online (Sandbox Code Playgroud)

该脚本在 require_once 函数处失败。我正在运行脚本: php -d allowed_url_include=On script.php 但要确保我已在 php.ini 中将allow_url_include 和allow_url_fopen 设置为On

如果我将http://xx.xxx.xxx.xx:8080/path/to/myfile.inc复制到浏览器,我就会收到该文件。我也尝试过包含其他远程文件(在标准端口 80 上),但仍然没有成功

我真正感到困惑的是,一切都可以在我办公室的本地计算机(mac、ubuntu)上运行,但不能在我们的服务器上运行。我已经在两台不同的服务器(虚拟服务器和专用服务器)上对其进行了测试。我可以使用 fopen() 获取该文件。

php linux require remote-file-inclusion

3
推荐指数
1
解决办法
3469
查看次数

标签 统计

linux ×1

php ×1

remote-file-inclusion ×1

require ×1