Jump to content

Why is "Enable CGI" in the webservice configuration


Recommended Posts

I have been wondering a bit about this.

What does "Enable CGI mode for PHP" have to do with Prestashops Webservice and why is it specific to the webservice page ?

 

On some hosts, I find that everything works fine, except for the webservice.

If I try to access the API through the browser (or any other way for that matter), The API constantly asks for an authentication token (webservice key), even though I provided it with the correct key once.

 

This behaviour goes away if I choose to "enable CGI mode for php".

 

Im not even sure that the hosting provider uses CGI mode, in most cases I have no way of knowing (if I dont ask the hosting provider, that is).

 

Well, just wondering, and could not find any obvious reason.

 

Cheers

Morten

Link to comment
Share on other sites

  • 3 months later...
  • 2 years later...

The option is associated with this variable in the PS code 'PS_WEBSERVICE_CGI_HOST'

And searching all of the PS code for the usage of 'PS_WEBSERVICE_CGI_HOST', turns up only the following code in the Tools class.  This adds a rewrite rule to the htaccess file
 

        if (Configuration::get('PS_WEBSERVICE_CGI_HOST')) {
            fwrite($write_fd, "RewriteCond %{HTTP:Authorization} ^(.*)\nRewriteRule . - [E=HTTP_AUTHORIZATION:%1]\n\n");
        }

You will have to do some additional research if you want to know what that rule actually does

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...