Jump to content

Recommended Posts

I am trying to use my key to working with an accounting link.


But the access from prestashop is not happening.


I have done a ht regeneration

I have generated the key and ticked all the permissions and enabled.


When I test the key on the browser it just returns the sign in box over and over again.


My host is siteground and I read somewhere there may be an issue in regards to recognition of php as cgi. (I have no idea what this means).


Is there a fix.


I am using



Share this post

Link to post
Share on other sites

I read about this issue elsewhere and asked my host and received the follwing.

Hello Julie,


Indeed it seems that the api URL above uses Apache authentication initiated through a PHP script, but since our setup is via a CGI gateway, the PHP is unable to use the apache authentication. The only solution in this case is to change the PHP to be loaded as Apache module instead, but this is not available on our shared hosting servers.




So guys I know the fix is to create a .HTaccess.txt (something I have never done before) and install the following script into the dispatcher .php. but I am unsure where exactly it would go.


Then in your PHP script you should add the following, right before your user/pass check routine:

list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = explode(':' , base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6)));

So here it is how a sample PHP script using HTTP Authentication would look like:


// split the user/pass parts

list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = explode(':', base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6)));


// open a user/pass prompt

if (!isset($_SERVER['PHP_AUTH_USER'])) {

header('WWW-Authenticate: Basic realm="My Realm"');

header('HTTP/1.0 401 Unauthorized');

echo 'Text to send if user hits Cancel button';


} else {

echo "<p>Hello, </p>".$_SERVER['PHP_AUTH_USER'];

echo "<p>You entered as your password: </p>".$_SERVER['PHP_AUTH_PW'];





Can anyone help me?

Share this post

Link to post
Share on other sites

I found the fix but I am unsure I have the skills to implement it.


I have given writing the ht file a go but not yet loaded it and a for the next part I believe I go in to the web sevice folder into the dispatcher .php but I an a little anxious that I will paste it in the wrong place.




Share this post

Link to post
Share on other sites

I have updated to, and in the menu Tools -> Webservice it appears the option for Apache + CGI. I have had a look to dispatcher.php and it does exactly what your link said.


But it does not even work... I do not know what to do now.

Share this post

Link to post
Share on other sites

Solved!!!! I add the .htaccess in the webservices directory with this text:

<IfModule mod_rewrite.c>

RewriteEngine on

RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]



Then I stopped webservice, I started webservices... and it worked fine!!!!! Remember I first updated to version.



Thank you very much

  • Like 1

Share this post

Link to post
Share on other sites
  • 7 years later...

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...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More