the hat lady Posted February 8, 2012 Share Posted February 8, 2012 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 1.4.6.25 Cheers Link to comment Share on other sites More sharing options...
the hat lady Posted February 8, 2012 Author Share Posted February 8, 2012 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: <?php // 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'; exit; } 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? Link to comment Share on other sites More sharing options...
CarlosAdrian Posted February 9, 2012 Share Posted February 9, 2012 Same problem here. Did you solve it? My host works on Apache + CGI. Is there any way to use web service on this platform? Or must I change my host? Thank you Link to comment Share on other sites More sharing options...
the hat lady Posted February 9, 2012 Author Share Posted February 9, 2012 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. link. http://www.sslcatacombnetworking.com/articles/http-authentication-php-cgi.html Link to comment Share on other sites More sharing options...
CarlosAdrian Posted February 13, 2012 Share Posted February 13, 2012 I have updated to 1.4.7.0, 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. Link to comment Share on other sites More sharing options...
CarlosAdrian Posted February 13, 2012 Share Posted February 13, 2012 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] </IfModule> Then I stopped webservice, I started webservices... and it worked fine!!!!! Remember I first updated to 1.4.7.0 version. Thank you very much 1 Link to comment Share on other sites More sharing options...
Pixel68 Posted November 21, 2019 Share Posted November 21, 2019 Carlos...YOU....ARE...THE...BEST! It works perfectly. It has been 10 days I am looking at the solution. Webservice Prestashap Apache auth Link to comment Share on other sites More sharing options...
Pixel68 Posted November 22, 2019 Share Posted November 22, 2019 Carlos...YOU....ARE...THE...ONE! It's working!! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now