尝试访问本地主机时权限被拒绝
Permission denied while trying to access localhost
在 Centos 7 机器上的 PHP 7.2 中,我正在尝试访问 Apache Jena Fuseki 3.6 SPARQL 端点。
Fuseki 运行s 在端口 3030 上,数据集的名称是 ds
我可以成功 运行 curl http://localhost:3030/ds
- 即使在该系统上登录与没有任何权利的用户。
到目前为止一切似乎都很好。
但是,当我尝试在 PHP 脚本中执行 fopen("http://127.0.0.1:3030/ds","r");
或 fopen("http://localhost:3030/ds","r");
时,我总是以 PHP Warning: fopen(http://localhost:3030/ds): failed to open stream: Permission denied
.
结束
从 WWW 或什至从与 fopen("http://localhost/mytest.html","r");
完全相同的 Apache 服务器获取文件仍然有效。
访问不同的本地主机端口是否需要任何特殊权限? firewalld
已停用,顺便说一句。
事实证明,SELinux 是问题的原因,阻止 Apache 在其他端口上进行出站连接。
看这里:http://sysadminsjourney.com/content/2010/02/01/apache-modproxy-error-13permission-denied-error-rhel/
在 Centos 7 机器上的 PHP 7.2 中,我正在尝试访问 Apache Jena Fuseki 3.6 SPARQL 端点。
Fuseki 运行s 在端口 3030 上,数据集的名称是 ds
我可以成功 运行 curl http://localhost:3030/ds
- 即使在该系统上登录与没有任何权利的用户。
到目前为止一切似乎都很好。
但是,当我尝试在 PHP 脚本中执行 fopen("http://127.0.0.1:3030/ds","r");
或 fopen("http://localhost:3030/ds","r");
时,我总是以 PHP Warning: fopen(http://localhost:3030/ds): failed to open stream: Permission denied
.
从 WWW 或什至从与 fopen("http://localhost/mytest.html","r");
完全相同的 Apache 服务器获取文件仍然有效。
访问不同的本地主机端口是否需要任何特殊权限? firewalld
已停用,顺便说一句。
事实证明,SELinux 是问题的原因,阻止 Apache 在其他端口上进行出站连接。
看这里:http://sysadminsjourney.com/content/2010/02/01/apache-modproxy-error-13permission-denied-error-rhel/