2016-05-17 80 views
0

我想通过cURLIIS7中发布数据。我的代码在cakePHPcURL路径不能在IIS7中工作

我在本地主机安装IIS与端口8090,并给予网址为cURL为下这是可以正常使用:

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

我的问题是不具有端口I部署相同的代码到其他系统的IIS

因此,我改变网址:

http://localhost/project/project_name/test_post 

但作为 'localhost' 的不工作我得到的错误。

这是什么问题?

我该如何解决这个问题?

回答

1

嗨,

是正确配置IIS 7中在CakePHP港口在另一个系统上并执行IIS 7的运行与正确的PHP版本?是否安装了本地主机上的IIS7上的数据库?在IIS 7上启用mod_rewrite? web.config在IIS 7中更改了吗?

<?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, 

问候

阿克塞尔·阿诺德班格特 - 黑尔措根拉特2016