woocommerce api error

Discussion in 'Installation/Configuration' started by ariban99, Apr 29, 2020.

  1. ariban99

    ariban99 Member

    can the ufw firewall be blocking anything? if yes, how do i open it for curl
     
  2. ariban99

    ariban99 Member

    here are my error logs, any of this means anything for this issue?
    Sun May 03 00:06:05.348884 2020] [proxy_fcgi:error] [pid 17645] [client 71.38.223.185:62808] AH01067: Failed to read FastCGI header
    [Sun May 03 00:06:05.348925 2020] [proxy_fcgi:error] [pid 17645] (104)Connection reset by peer: [client 71.38.223.185:62808] AH01075: Error dispatching request to :
    [Sun May 03 00:07:03.976500 2020] [php7:warn] [pid 17936] [client 71.38.223.185:50595] PHP Warning: session_start(): open(/var/www/clients/client0/web1/tmp/sess_2uu92kkd1ctm9o2h7bs27l5qnl, O_RDWR) failed: Permission denied (13) in /var/www/clients/client0/web1/web/wp-content/plugins/pgs-core/social-login/pgssl-core.php on line 14, referer: https://domain.com/shop/
    [Sun May 03 00:07:03.977096 2020] [php7:warn] [pid 17936] [client 71.38.223.185:50595] PHP Warning: session_start(): Failed to read session data: files (path: /var/www/clients/client0/web1/tmp) in /var/www/clients/client0/web1/web/wp-content/plugins/pgs-core/social-login/pgssl-core.php on line 14, referer: https://domain.com/shop/
     
  3. till

    till Super Moderator Staff Member ISPConfig Developer

    Run this command as root user and try again:

    Code:
    rm -f /var/www/clients/client0/web1/tmp/sess_*
    You probably switched suexec on and off in the site while using it, this can lead to such problems. ensure that suexec is enabled in the site.
     
  4. ariban99

    ariban99 Member

    Hi Till
    I ran the command then i tried:
    curl https://DOMAIN.com/wp-json/wc/v2/products?consumer_key=ck_2xxxxxxxxconsumer_secret=xxxx
    and got this error:
    {"code":"woocommerce_rest_cannot_view","message":"Sorry, you cannot list resources.","data":{"status":401}}

    if you can think of anything else, please let me know.
    i know its not a woocommerce issue because it works on bluehost.com shared server and also on Hostgator shared server. its something to do with the server that ispconfig is on
     
  5. till

    till Super Moderator Staff Member ISPConfig Developer

  6. till

    till Super Moderator Staff Member ISPConfig Developer

  7. ariban99

    ariban99 Member

    it is the right now, i revoked the keys and tried again with new ones and its the same issue.
    why would the keys work on a shared hosting (literally copied the website files and database to a shared hosting to test and it works perfectly)
    and i am using SSL on the site
     
  8. till

    till Super Moderator Staff Member ISPConfig Developer

    That's woocommerce internals. It might be that they are locked to a specific system or IP or domain or something similar or that you used a WordPress bases setup for your tests on the other system which has other plugins installed. You should better contact Woocommerce support for this as it does not look to be an ISPConfig related issue to me.
     
  9. ariban99

    ariban99 Member

    it doesn't make sense, i cloned the website files and database and installed them on bluehost.com and also hostgator.com and they work on both shared hosting. its something to do with my server and ispconfig
     
  10. till

    till Super Moderator Staff Member ISPConfig Developer

    Did you contact the Woocommerce support? What did they told you about the 401 error from their API? They can probably also tell you how to debug their API further to find out why it does not work, probably there are some advanced logging options in Woocommerce that you might turn on which can tell you what's wrong.
     
  11. ariban99

    ariban99 Member

    i did all they said was to use postman which i am trying to figure out how to understand it
    not everyone is as cool and nice as you are to actually try to help!
     
  12. Jesse Norell

    Jesse Norell ISPConfig Developer Staff Member ISPConfig Developer

    After running the command to clean up old session files above, did the php errors stop? Do you have anything else/new in the error log?
     
  13. ariban99

    ariban99 Member

    after removing all sessions with the code from till, i still get this error
    woocommerce_rest_cannot_view, Sorry, you cannot list resources, 401
     
  14. ariban99

    ariban99 Member

    someone said he updated his servers dns to google 8.8.8.8 and his started working.
    how can i update it in debian for ispconfig and test it out? if i do nano /etc/resolv.conf and manually change it there, when i reboot, all my changes are reverted back to default ones.
    thank you
     
  15. till

    till Super Moderator Staff Member ISPConfig Developer

    You probably use a virtual server then and the nameserver configuration is controlled by your ISP on the host server of that VM.

    Ok, this an indication that there is no PHP error anymore, and as explained above, a 401 error is a woocommerce API authentication issue and not a PHP error. You should ask the woocommerce guys if there is any log that might give you a more detailed error message.
     
  16. ariban99

    ariban99 Member

    thank you till, i asked woocommerce, they didn't respond about the log yet, however someone responses that i should make sure that my PHP has allow_url_fopen turned on, i am on debian 10 apache (https://www.howtoforge.com/perfect-server-debian-10-buster-apache-bind-dovecot-ispconfig-3-1/) and my website uses php-fpm how do i make sure this is turned on in my PHP?

    thank you
     
  17. nhybgtvfr

    nhybgtvfr Well-Known Member HowtoForge Supporter

    if allow_url_fopen is disabled, it'll be done in exactly the same place as for curl_exec.
    it probably isn't disabled, it's not by default so you'd have to make that change yourself, and i'm sure you'd have remembered doing something like that.
     
  18. ariban99

    ariban99 Member

    i did not turn it out. i checked my PHP.ini file and allow_url_fopen is on
    however for curl, i don't have anything curl_exec
    all i have with curl in my PHP is as follows
    [curl]
    ; A default value for the CURLOPT_CAINFO option. This is required to be an
    ; absolute path.
    ;curl.cainfo =

    ; - Many DLL files are located in the extensions/ (PHP 4) or ext/ (PHP 5+)
    ; extension folders as well as the separate PECL DLL download (PHP 5+).
    ; Be sure to appropriately set the extension_dir directive.
    ;
    ;extension=bz2
    ;extension=curl

    how do i have the curl exec, what do i type in my PHP?
     
  19. Jesse Norell

    Jesse Norell ISPConfig Developer Staff Member ISPConfig Developer

    It wouldn't hurt to set 'curl.cainfo = /etc/ssl/certs/' while you're in there (though it won't help with your current issue), but otherwise that's fine. curl_exec is a function, if you had added it to the disabled_functions list in the php.ini file (which you almost certainly have not), that function would not work.

    To reiterate what is going on here, your web server is answering the https requests just fine, it just happens that the woocommerce api is returning the 401 error, for whichever of the numerous reasons it does that. Most likely if there were a php related issue you would see something in the logs (which you did earlier, and fixed).

    Did you enable the WP_DEBUG settings as suggested earlier? Anything show up in your wordpress debug log then?
     
  20. ariban99

    ariban99 Member

    i added to my PHP files
    yes i enabled debugging and it doesn't show anything. the error log from my server shows this, not sure if its related
    [Tue May 05 16:22:48.993009 2020] [proxy_fcgi:error] [pid 28494] (70014)End of file found: [client 63.33.58.220:52258] AH01075: Error dispatching request to : (reading input brigade)
     

Share This Page