cURL路径在IIS7中不起作用

时间:2016-05-17 06:13:09

标签: php cakephp curl

我正试图通过cURL中的IIS7发布数据。我的代码在cakePHP

我在我的localhost中使用端口8090安装了IIS并为cURL提供了以下网址,该网址完美无缺:

http://localhost:8090/project/project_name/test_post

我的问题是我将相同的代码部署到没有端口的IIS的其他系统。

所以我将网址更改为:

http://localhost/project/project_name/test_post

但我得到的错误是“本地主人”。不起作用。

这有什么问题?

我该如何解决这个问题?

1 个答案:

答案 0 :(得分:1)

<强>您好,

是在另一个系统上的IIS 7中配置的cakePHP中的端口,IIS 7是否运行了正确的php版本?是否安装了localhost机器上的IIS7上的数据库?是否在IIS 7上启用了mod_rewrite?是否在IIS 7中更改了web.config?

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="Exclude direct access to webroot/*"
                  stopProcessing="true">
                    <match url="^webroot/(.*)$" ignoreCase="false" />
                    <action type="None" />
                </rule>
                <rule name="Rewrite routed access to assets(img, css, files, js, favicon)"
                  stopProcessing="true">
                    <match url="^(img|css|files|js|favicon.ico)(.*)$" />
                    <action type="Rewrite" url="webroot/{R:1}{R:2}"
                      appendQueryString="false" />
                </rule>
                <rule name="Rewrite requested file/folder to index.php"
                  stopProcessing="true">
                    <match url="^(.*)$" ignoreCase="false" />
                    <action type="Rewrite" url="index.php"
                      appendQueryString="true" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

也许您必须使用正确的配置设置在IIS 7服务器上重建cakeApp。

 class DATABASE_CONFIG {
        public $default = array(
            'datasource'  => 'Database/Mysql',
            'persistent'  => false,
            'host'        => 'localhost',
            'port'        => '8080'
            'login'       => 'cakephpuser',
            'password'    => 'c4k3roxx!',
            'database'    => 'my_cakephp_project',
            'prefix'      => ''
        );

}

并检查你的cakeApp是否有类似的东西:

$request = array(
    'method' => 'POST',
    'uri' => array(
        'scheme' => 'http',
        'host' => $notificationUrl,
        'port' => 8080,

祝你好运

Axel Arnold Bangert - Herzogenrath 2016