Thursday, January 27, 2022

[FIXED] cURL path not working in IIS7

Issue

I am trying to post data through cURL in IIS7. My code is in cakePHP.

I installed IIS in my localhost with port 8090 and giving URL for cURL as the following which is working perfectly:

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

My problem is I deployed same code to other system of IIS having no port.

So I changed URL to:

http://localhost/project/project_name/test_post

But am getting error as 'localhost' not functioning.

What is wrong in this?

How can I resolve this?


Solution

Hi,

is the port in cakePHP configured right in IIS 7 on the other system and does IIS 7 run with the right php version? Is a database on IIS7 on the localhost machine installed? Is mod_rewrite enabled on IIS 7? Is the web.config changed in 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>

Perhaps you have to rebuild the cakeApp on the IIS 7 server with the right config settings.

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

}

and check your cakeApp if there is something like that:

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

Best regards

Axel Arnold Bangert - Herzogenrath 2016



Answered By - Axel Arnold Bangert

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.