PrestaShop / PrestaShop

PrestaShop is the universal open-source software platform to build your e-commerce solution.
https://www.prestashop-project.org/
Other
8.14k stars 4.8k forks source link

Webservice stop working from 30-08-19 #15385

Closed ninefingersodnd closed 5 years ago

ninefingersodnd commented 5 years ago

Describe the bug Webservice does not work anymore from 30-08-2019, We do not have changed anything, we got the error on 2 differed servers.

The error: Please activate the 'mod_auth_basic' Apache module to allow authentication of PrestaShop's webservice.

Cant get it working anymore.

But the mod is activated and working. We use FPM served by apache. We have plesk onyx installed.

To Reproduce Steps to reproduce the behavior:

  1. Go to webservice
  2. see error; mod_auth_basic needs to be activated.

Additional information PrestaShop version: 1.7.6.0 and 1.7.6.1 PHP version: 7.2.22 - FPM apache Plesk: Onyx 17.8.11

khouloudbelguith commented 5 years ago

Hi @ninefingersodnd,

I did not manage to reproduce the issue with PS1.7.6.1. It is OK https://drive.google.com/file/d/18uIdif_JeOWJi4C4GpkbS1I21jcYcEUL/view Could you please try to create a check_phpinfo.php file and Write this PHP Code:

<?php

// Show all information, defaults to INFO_ALL
phpinfo();

?>

Then Navigate to Url like www.example.com/check_phpinfo.php and It will show you PHP file in the server A similar issue solved by the server: https://github.com/PrestaShop/PrestaShop/issues/15283 Thanks!

ninefingersodnd commented 5 years ago

Hi @ninefingersodnd,

I did not manage to reproduce the issue with PS1.7.6.1. It is OK https://drive.google.com/file/d/18uIdif_JeOWJi4C4GpkbS1I21jcYcEUL/view Could you please try to create a check_phpinfo.php file and Write this PHP Code:

<?php

// Show all information, defaults to INFO_ALL
phpinfo();

?>

Then Navigate to Url like www.example.com/check_phpinfo.php and It will show you PHP file in the server A similar issue solved by the server: #15283 Thanks!

Hi, The solution you have mentioned is change host and reinstall all modules? I cant see a clear solution for the problem in te issue tread there? Or i'm not checking it right?

Below the PHP output: https://www.odnd.nl/phpinfo.php

khouloudbelguith commented 5 years ago

@ninefingersodnd, as you can see in your PHP info file the "mod_auth_basic" doesn't exist. https://drive.google.com/file/d/1BjuU9us0e_cEje8fn5f66YWZ82J8x7Mn/view Thanks to check the issue with your host & feedback.

ninefingersodnd commented 5 years ago

@ninefingersodnd, as you can see in your PHP info file the "mod_auth_basic" doesn't exist. https://drive.google.com/file/d/1BjuU9us0e_cEje8fn5f66YWZ82J8x7Mn/view Thanks to check the issue with your host & feedback.

I have image from my plesk apache settings, i see that Auth_basic is enabled, or is this not the mod? Thanks for your support!

www.imgur.com/a/81iqXvc

khouloudbelguith commented 5 years ago

@ninefingersodnd, it should be a module Apache https://github.com/PrestaShop/PrestaShop/blob/aec97ddb1551fd7d6d56f75549a992d6937caf50/src/Core/Webservice/ServerRequirementsChecker.php#L42 Thanks!

ninefingersodnd commented 5 years ago

I realy don't know wha tis happening, it worked fine, it says enabled in the apache config, but it is not on the phpinfo.

I realy dont know how i get it to work.

khouloudbelguith commented 5 years ago

@ninefingersodnd, Could you please try to create this test.php script on your server to check if the mod_auth_basic is enabled

<?php
print_r(apache_get_modules());
?>

Thanks!

ninefingersodnd commented 5 years ago

<?php print_r(apache_get_modules()); ?>

With the php code given, i'll get a error 500

khouloudbelguith commented 5 years ago

@ninefingersodnd, have you tried to contact your host about this issue? Thanks to check with them & feedback.

ninefingersodnd commented 5 years ago

It is a Unmanaged VPS

@ninefingersodnd, as you can see in your PHP info file the "mod_auth_basic" doesn't exist. https://drive.google.com/file/d/1BjuU9us0e_cEje8fn5f66YWZ82J8x7Mn/view Thanks to check the issue with your host & feedback.

Just called the hosting company, It is a VPS, and it is a Apache module, not a PHP one, so this is not in phpinfo. It is enabled and should be working fine.

print_r(apache_get_modules()); just gives me a blanc page

Just tested on a fresh installation of prestashop 1.7.5.2 and there is no problem. it has begon with 1.7.6.0> - Going further, i have upgraded the clean install of 1.7.5.2 to 1.7.6.1 and the problem is there.

khouloudbelguith commented 5 years ago

@ninefingersodnd, Could you please provide me the access to your shop to test it. This is a public space. You can provide me the credentials by email. My address mail: khouloud.belguith@prestashop.com Let's be safe! Thanks!

khouloudbelguith commented 5 years ago

Hi @ninefingersodnd,

As you said, in your case, Auth_basic is enbled in your apache but the mod_auth_basic is not enabled on your PHP installation. You need to check again your host.

Thanks!

ninefingersodnd commented 5 years ago

Hi,

Plesk itself does not handle apache_mod PHP, as apache does not aloud multiple PHP configurations. This only works on the Vendor_OS but this is PHP 5.4.16

well as i said, it is working on the 1.7.5 version of prestashop, as i can see in the configuration of apache the module is standard loaded /etc/httpd/conf.modules.d/00-base.conf.

This file loads most of the modules included with the Apache HTTP Server itself.

LoadModule access_compat_module modules/mod_access_compat.so LoadModule actions_module modules/mod_actions.so LoadModule alias_module modules/mod_alias.so LoadModule allowmethods_module modules/mod_allowmethods.so LoadModule auth_basic_module modules/mod_auth_basic.so LoadModule auth_digest_module modules/mod_auth_digest.so LoadModule authn_anon_module modules/mod_authn_anon.so LoadModule authn_core_module modules/mod_authn_core.so LoadModule authn_dbd_module modules/mod_authn_dbd.so

etc

ninefingersodnd commented 5 years ago

httpd -M SSH command gives the following

auth_basic_module (shared) dit is de mod_auth_basic module and is loaded correctly

Loaded Modules: core_module (static) so_module (static) http_module (static) access_compat_module (shared) actions_module (shared) alias_module (shared) allowmethods_module (shared) auth_basic_module (shared) auth_digest_module (shared) authn_anon_module (shared) authn_core_module (shared) authn_dbd_module (shared) authn_dbm_module (shared) authn_file_module (shared) authn_socache_module (shared) authz_core_module (shared) authz_dbd_module (shared) authz_dbm_module (shared) authz_groupfile_module (shared)

khouloudbelguith commented 5 years ago

Hi @ninefingersodnd,

As reported in this comment https://github.com/PrestaShop/PrestaShop/issues/15270#issuecomment-528291069 The warning is not correct & the webservice is well working?

Thanks!

ninefingersodnd commented 5 years ago

That is correct, the warning is a false warning of the prestashop system, and should be corrected in further versions of prestashop.

khouloudbelguith commented 5 years ago

@ninefingersodnd, could you please provide a screenshot about your server information (From your BO => Advanced Parameters => Information page)

Thanks!

khouloudbelguith commented 5 years ago

@ninefingersodnd, I checked again your shop & yo are using an Nginx server? image

Thanks!

ninefingersodnd commented 5 years ago

Well i looks like it :) Maybe that is the problem. In checking its configuration

khouloudbelguith commented 5 years ago

@ninefingersodnd, thanks to provide me a screenshot about your server configuration from your BO => Advanced Parameters => Information page In your first comment => you just said that

We use FPM served by apache.

Thanks!

ninefingersodnd commented 5 years ago

informations

It says just apache, Yes it is FPM-Apache

khouloudbelguith commented 5 years ago

@ninefingersodnd, I checked your shop again & the response server is Nginx. image It should Apache like in my case image

Could you please check with your host & feedback.

ninefingersodnd commented 5 years ago

Hi,

The nginx is a reverse proxy server, has no effect on the Apache module handlers, As proof i have set the service for this handler on off.

I get a fault on the webservice js script see:

informations

khouloudbelguith commented 5 years ago

@ninefingersodnd, Could you please try to follow these steps:

  1. go to Network tab
  2. Reload your page
  3. wait for your error, you should see red request information in Network tab
  4. click on it, you should see the error message in "Response" or "Preview" tab

Thanks!

ninefingersodnd commented 5 years ago

@ninefingersodnd, Could you please try to follow these steps:

  1. go to Network tab
  2. Reload your page
  3. wait for your error, you should see red request information in Network tab
  4. click on it, you should see the error message in "Response" or "Preview" tab

Thanks!

I do not know wat your mean, you can reproduce, your login credentials are still valid.

just go to webservice in presta and hit inspect.

khouloudbelguith commented 5 years ago

@ninefingersodnd, I checked in my case the loaded module apache & it is similar to yours. auth_basic_module (shared) image But in your case, it is not added as a PHP extension.

Thanks!

ArteInfoRM commented 5 years ago

Same problem with version 1.7.6.1 (upgrade from 1.7.6.0) ‪CentOS Linux 7.6.1810 Plesk Onyx 17.8.11 PHP 7.2.22 FPM Apache

The web service seems to work anyway No problem with previous versions of PrestaShop on the same server.

khouloudbelguith commented 5 years ago

Ping @PrestaShop/prestashop-core-developers what do you think? In my case, it is OK, the warning is not displayed with PS1.7.5.2 & PS1.7.6.1, checked with two different servers.

Thanks!

ArteInfoRM commented 5 years ago

The web service works. I believe the warning is wrong. auth_basic_module is correctly loaded and works.

You can replicate the problem on any server with Plesk CentOS Linux 7.6.1810 and Plesk Onyx 17.8.11

ninefingersodnd commented 5 years ago

The web service works. I believe the warning is wrong. auth_basic_module is correctly loaded and works.

You can replicate the problem on any server with Plesk CentOS Linux 7.6.1810 and Plesk Onyx 17.8.11

This is the answer!

PierreRambaud commented 5 years ago

FYI: if apache_get_modules generate a 500 error, this is because your php version doesn't run under apache. It looks like the bug is related to how Plesk manage webservers but maybe I'm wrong. Can you have a check @matks it's maybe related to https://github.com/PrestaShop/PrestaShop/blob/develop/src/Core/Webservice/ServerRequirementsChecker.php#L124

khouloudbelguith commented 5 years ago

Hi!

I used a server with PHP-fpm folwing this link: http://keksus.com/upgrade-php5-to-php7-1-on-debian.html Here's my PHP info file phpinfo().pdf I tried with this command in my terminal > apache2ctl -M I have all this module apache enabled

 core_module (static)
 so_module (static)
 watchdog_module (static)
 http_module (static)
 log_config_module (static)
 logio_module (static)
 version_module (static)
 unixd_module (static)
 access_compat_module (shared)
 alias_module (shared)
 auth_basic_module (shared)
 authn_core_module (shared)
 authn_file_module (shared)
 authz_core_module (shared)
 authz_host_module (shared)
 authz_user_module (shared)
 autoindex_module (shared)
 deflate_module (shared)
 dir_module (shared)
 env_module (shared)
 filter_module (shared)
 mime_module (shared)
 mpm_prefork_module (shared)
 negotiation_module (shared)
 pagespeed_module (shared)
 proxy_module (shared)
 proxy_fcgi_module (shared)
 reqtimeout_module (shared)
 rewrite_module (shared)
 setenvif_module (shared)
 status_module (shared)

Using this script

<?php
print_r(apache_get_modules());
?>

=> error 500.

On the same server PS1.7.5.2 => no warnings about the mod_auth_basic on the webservice page image

With PS1.7.6.1 & 1.7.7.0(develop branch) => warning: Vous devez activer le module Apache 'mod_auth_basic' afin de permettre l'authentification au service web image

My server information image

So, it is a regression on PS1.7.6 only when using PHP-fpm. I’ll add this to the debug roadmap so that it’s fixed. If you have already fixed it on your end or if you think you can do it, please do send us a pull request! Thanks!

peorthyr commented 5 years ago

Good day all. We are getting this issue on all our websites that are on a specific hosting (which has already told us that the "mod_auth_basic" is not an option on the plan of the hosted sites.

Since this regression is affecting most (if not all) the websites we are managing, I'd like to understand what we could do, what I understand is that we got 3 options: 1) Downgrade Prestashop to 1.7.5 (which was working without problems on the very same hosting) 2) Wait for the patch (but in this case I really need to know how long does it will take). 3) try to patch somehow Presashop waiting for the official release.

since the option 2 could take a log time, I'd like to know if there is a standard procedure to downgrade Prestashop to the 1.7.5. or if there is some hotfix, hack, or strange idea that could work in order to make this thing working again. thanks in advance.

IlPizza79 commented 5 years ago

Hi, I've noticed this issue is in "To be tested" step since 3 days... can you please tell us how it's going? Can you tell us when an update will be released? Or at least can you tell us a fix for current Prestashop version? Thanks in advance!

peorthyr commented 5 years ago

Good day all. We are getting this issue on all our websites that are on a specific hosting (which has already told us that the "mod_auth_basic" is not an option on the plan of the hosted sites.

Since this regression is affecting most (if not all) the websites we are managing, I'd like to understand what we could do, what I understand is that we got 3 options:

  1. Downgrade Prestashop to 1.7.5 (which was working without problems on the very same hosting)
  2. Wait for the patch (but in this case I really need to know how long does it will take).
  3. try to patch somehow Presashop waiting for the official release.

since the option 2 could take a log time, I'd like to know if there is a standard procedure to downgrade Prestashop to the 1.7.5. or if there is some hotfix, hack, or strange idea that could work in order to make this thing working again. thanks in advance.

Good day again. I see there where updates on the card, may I ask you if it's possible to have an answer to one of my questions related to this topic? we are trying to understand "what to say to our clients" and we are blocked on "we are trying to figure out what Prestashop developers are doing" and this is a little vague. I'm not asking for a solution or for a rush in any case, just something I can say regarding the points discussed above.

khouloudbelguith commented 5 years ago

@peorthyr, the fix is in progress, the issue will be fixed in the next patch 1.7.6.2.

THanks!

IlPizza79 commented 5 years ago

Hi khouloudbelguith, can you please give us an approximate estimate of the release date? Thanks in advance!

khouloudbelguith commented 5 years ago

@peorthyr, PS1.7.6.2, if all regressions are fixed https://github.com/PrestaShop/PrestaShop/milestone/57 And the patch should be tested then released.

Thanks!

IlPizza79 commented 5 years ago

Sorry to bump again... any news? Since last update, we still can't use webservice on our website... and that's frustrating :-(

PierreRambaud commented 5 years ago

Since these are just warning in back office, I don't understand why you can't use webservices? 🤔

IlPizza79 commented 5 years ago

Since these are just warning in back office, I don't understand why you can't use webservices? 🤔

You know, you're right :-) I must apologize, my webservice were really broken but it wasn't Prestastashop fault. After reading your comment I double checked my server configuration and I found out that it was just a misconfiguration. My fault :-(

I REALLY thank you for your comment, you've pointed me in the right direction :-)

PierreRambaud commented 5 years ago

@IlPizza79 At least because of you, we improve our warnings messages :sweat_smile: Thanks for your contribution!

ManuBZL commented 4 years ago

I have more or less the same issue. I have installed PS 1.7.6.1 and the webservice does not work. I try to test the webservice going to: https://mydomain.xyz/api . The web prompts the classic login asking for the webservice key, when I put the key in the "user" input does nothing. It asks me again and again like an infinite loop.

I have PHP 7.1.32 and Apache/2.4.6 runing on nginx as reverse proxy like @ninefingersodnd. The backoffice shows the same error about activate "mod_auth_basic" but is not only a warning, webservice is not working.

I checked the httpd logs and shows nothing relevant... i do not know what to do. I am working in a new project with presta 1.7 and i can't get it working.

I tried fresh install of ps 1.7.6.0 and 1.7.6.1, same results...

PierreRambaud commented 4 years ago

The backoffice doesn't display an error. It's a warning, this isn't the same thing. More, warnings messages on back office are not triggered while running webservices features. You need to wait for 1.7.6.2 to don't have these warnings :)

ManuBZL commented 4 years ago

I know is a warning, but the webservice is not working. That's what i'm trying to say

IlPizza79 commented 4 years ago

Try to add following code in your htaccess: RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

Follow this tutorial, it may help you as it helped me :-) https://www.emanuelefantin.it/blog/view/correggere-l-errore-bad-auth-key-per-le-api-di-prestashop-1753

ManuBZL commented 4 years ago

OK. thank you. Seems to work. Is something related to the htaccess file generated by prestashop.

IlPizza79 commented 4 years ago

I guess it's not strictly related to the htaccess generated by prestashop, I think it's more an hosting isuue. I had the same website on two different hostings and one of them was working without any issue, the other one needs the new rule in htaccess.

ManuBZL commented 4 years ago

Yeah, maybe. But with presta 1.6 same server, I do not have that problem.

caygri commented 4 years ago

any update?