Printful do not connect to prestashop over a virtualmin hosted prestashop

Hello!

Im using a dedicated server with webmin 1.941 / virtualmin 6.08 on Ubuntu 18.04.3.
I have created a virtual server and installed in it Prestashop 1.7.6.4, running with PHP 7.1.33.

I want to connect Printful account to my prestashop, but when I follow the process I get an error message

Dang it

PrestaShop connect error: 
Could not connect to https://******.com/api. 
Please double-check the API key and its permissions. 
Full error: Client error: 
`GET https://********.com/api?output_format=XML` resulted 
in a `401 Unauthorized` response: 401 Unauthorized

the “**********” stands for my prestashop domain url on virtualmin.

So far I have searched google and figured out that it is not a prestashop issue nor prihtful issue. It is a server webmin/virtualmin issue but I am unable to figure out where to look or what to do.

Also something might give a clue, I uploaded a prestashop requirements verification script, it has a default password setup in it, when the script is called it pop up a window where I need to enter this default user/password, but for some reasons this is not working, when I type the user and password, the window keep prompting asking for credentials. This issue seems to be related to the previous one, probably some issue related to http/https authetification or something.
here is that script:
https://pastebin.com/vN1CzpVH

there is also a htaccess file given by prestashop but I do not understand the content, when I delete this file, the error become 404 when I try to connect prinful, so there is maybe something to do here :
https://pastebin.com/Tp6Qtm3M

I also use letsencrypt SSL embedded in virtualmin.

How can I fix this problem please ?

Edit:
I tried to put the url that Printful call, in the web navigator : https://**********.com/api?output_format=XML
this is resulting a popup asking for user/password, I have no idea why, here nothing work, I have tried all what is possible, anyway it is not supposed to ask for user/password, so this is why the connexion is failing. Still I don’t know where to look to solve this

Problem solved but I’m not sure its a good practise or safe.

I went in Virtualmin/my domain/server configuration/website options and I change the PHP script execution mode from FCGid to Apache mod_php

This have fixed the issue, I figured out this by reading somebody’s comment in PHP manual !

It is safe (sort of) if it is no a shared server. mod_php is not safe in a multi-tenant environment. But, if everybody on the server is trusted, it’s fine(ish), though the performance and resource usage cost is somewhat high.

Hello Joe
thank you, I’m alone in the server so I can consider it safe then.
Also I had to re-attribute all the public_html and its content to www-data:www-data otherwise prestashop would not work, is this fine ?

There is no other choice, if you’re using mod_php. mod_php runs as the Apache user (which is why it is not safe on a multi-tenant system).

This topic was automatically closed 14 hours after the last reply. New replies are no longer allowed.