2 Replies Latest reply on Sep 16, 2015 1:39 PM by eworbit

    error: Communication Error: (22) The requested URL returned error: 502 - This can be due to an invalid username or password, or if the FMPHP privilege is not enabled for that user.

    eworbit

      I use FM php library to push orders into a FM database.   Basically the program consists of normal php calls like so:

       

      new FileMaker(dbName, dbHost, dbLogon, dbPassword);

      newAddCommand()

      setField()

      setField()

      etc.... etc...

       

      $createResult = $create->execute();
      if(FileMaker::isError($createResult)){
      $message .= ' Create order error: '.$createResult->getMessage();
      $error = true ;
      } else {
      $foundRecords = $createResult->getRecords();
      $record   = $foundRecords[0];
      $_id_qte  = $record->getField('_id_QTE');
      $message .= ' Created the Order.|'.$_id_qte.'|';
      }

       

       

      Sometimes the FM Server 13 (now 14) sends this errors message: error: Communication Error: (22) The requested URL returned error: 502 - This can be due to an invalid username or password, or if the FMPHP privilege is not enabled for that user.

       

      I know it error has nothing to do with the user/pass or a privilege because my php script is set to retry upon failure and the second try always works.  95% the order goes in the first try.

       

      So, I'm suspecting that when FM is just too busy it errors out too easy.  I have 24 connected to a FM 14 Server on a Mac Pro (Late 2013), 3 Ghz 8-Core Intel Xeon E5, 64GB DDR3 with SSD drives. 

       

      So any ideas that I could see what could be the real problem or how can I get FM to give me the real error message and not a fake one?

      Thanks,

      -Eric

        • 1. Re: error: Communication Error: (22) The requested URL returned error: 502 - This can be due to an invalid username or password, or if the FMPHP privilege is not enabled for that user.
          eworbit

          In addition to calling $createResult->getMessage() I now call getErrorString() which simply returns "Unknown error"

           

          I'd also add that I get this error even when there is no real CPU load going on.  We have a very stable gigabit network as well.  FM Server just gets moody sometimes.

           

          Any ideas?

          -Eric

          • 2. Re: error: Communication Error: (22) The requested URL returned error: 502 - This can be due to an invalid username or password, or if the FMPHP privilege is not enabled for that user.
            eworbit

            The title of the Discussion should be:

            Communication Error: (22) The requested URL returned error: 502 - The Web Publishing Core and/or FileMaker Server services are not running.

             

            This is because a PHP function (stristr) was used incorrectly in Filemaker's PHP API scripts.  I get those haystacks and needles mixed up too.  FMI may have already corrected this, but I can't see they did.

             

            Below is all the adjustments I made to get more reliable connections by eliminating early timeouts.  All is working much smoother for us now.   I'm sure the same timeout settings would apply to the Windows Server folks.

             

            Hope this helps.

            -Eric

             

            1. Fix this script on the client machine running the PHP API:

            ../FMP12/FileMaker/Implementation/FileMakerImpl.php

            change:

            if (stristr("50", curl_error($Vd88fc6ed))) {

            to:

            if (stristr(curl_error($Vd88fc6ed),"50")) {

             

             

            2. Edit this file:

            /Library/FileMaker Server/Web Publishing/publishing-engine/php/yosemite/lib/php.ini

             

            change:

            default_socket_timeout = 60

            to:

            default_socket_timeout = 120

             

            change:

            max_execution_time = 30

            to:

            max_execution_time = 90

             

            change:

            max_input_time = 60

            to:

            max_input_time = 120

             

            change:

            session.cache_expire = 30

            to:

            session.cache_expire = 180

             

             

            3. Edit this file:

            /Library/FileMaker Server/Admin/admin-helper/WEB-INF/conf/mod_proxy.conf

            actually no edits but keep this file in mind for future.

             

            4. Edit this file:

            /Library/FileMaker Server/HTTPServer/conf/extra/httpd-proxy.conf

            add this statement after the closing tag </Proxy>:

             

            ProxyTimeout 180

             

            5. Edit this file:

            /Library/FileMaker Server/HTTPServer/conf/httpd.conf

             

            Add these statements after all the LoadModule statements:

             

            Timeout 180

            KeepAlive On

            MaxKeepAliveRequests 200

            KeepAliveTimeout 30

             

            6. Restart the apache server

            # cd "/Library/FileMaker Server/HTTPServer/bin"

            # sudo ./httpdctl graceful