Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 在Apache上显示卷曲&引用;禁止进入!错误403“;_Php_Apache_Curl - Fatal编程技术网

Php 在Apache上显示卷曲&引用;禁止进入!错误403“;

Php 在Apache上显示卷曲&引用;禁止进入!错误403“;,php,apache,curl,Php,Apache,Curl,我正在用cURL测试简单的API。它是,从一台Apache服务器的(php文件)调用另一台Apache服务器的(php文件)。在本地测试是可以的。但当我使用网络PC进行测试时,它显示以下403错误: 禁止访问! 您没有访问请求对象的权限。它受读保护,或者服务器不可读。 如果您认为这是服务器错误,请联系网站管理员。 错误403 呼叫服务器(服务器1)的代码为: 应答服务器(服务器2)的代码为: 两个Apache上都启用了cURL。那为什么呢?我需要做什么?如果您正在使用WAMP,请确保将服务器“

我正在用cURL测试简单的API。它是,从一台Apache服务器的(php文件)调用另一台Apache服务器的(php文件)。在本地测试是可以的。但当我使用网络PC进行测试时,它显示以下403错误:

禁止访问!
您没有访问请求对象的权限。它受读保护,或者服务器不可读。
如果您认为这是服务器错误,请联系网站管理员。
错误403

呼叫服务器(服务器1)的代码为:


应答服务器(服务器2)的代码为:


两个Apache上都启用了cURL。那为什么呢?我需要做什么?

如果您正在使用WAMP,请确保将服务器“联机”

第二,


您的htaccess是否阻止了它?

如果您正在使用WAMP,请确保将服务器“联机”

第二,


您的htaccess是否阻止了它?

这与cURL无关,问题在于您的Apache配置

Apache的配置方式是,
api.php
上的资源对运行脚本的机器不可用

在Apache配置中,对于根目录,需要检查以下指令:

# Yours will not look like this
# The key point is look at the 'Order' and 'Allow'/'Deny' directives for the root directory
Order allow,deny
Allow from all
看一看它下面的部分

或者,您可能在
api.php
中的某个地方有如下代码:

header('HTTP/1.1 403 Forbidden');
exit("Access forbidden!\nYou don't have permission to access the requested object. It is either read-protected or not readable by the server.\nIf you think this is a server error, please contact the webmaster.\nError 403");

…但是,根据您在代码中所说的,我认为这与Apache配置有关。

这与cURL无关,问题出在您的Apache配置上

Apache的配置方式是,
api.php
上的资源对运行脚本的机器不可用

在Apache配置中,对于根目录,需要检查以下指令:

# Yours will not look like this
# The key point is look at the 'Order' and 'Allow'/'Deny' directives for the root directory
Order allow,deny
Allow from all
看一看它下面的部分

或者,您可能在
api.php
中的某个地方有如下代码:

header('HTTP/1.1 403 Forbidden');
exit("Access forbidden!\nYou don't have permission to access the requested object. It is either read-protected or not readable by the server.\nIf you think this is a server error, please contact the webmaster.\nError 403");

…但是,根据您在代码中所说的,我认为这是关于Apache配置的。

禁止访问的!您没有访问请求对象的权限。它是受读保护的,或者服务器不可读。
不是清晰的消息吗?您查询的是您自己的服务器还是第三方服务器?
是否禁止访问!您没有访问请求对象的权限。它是受读保护的,或者服务器不可读。
不是清晰的消息吗?您查询的是您自己的服务器还是第三方服务器?