Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I am getting the error while setting on Runcloud Based Setup on Normal setup its working like a charm but on Runcloud I am have this issue. #1134

Open
Arya-Aniket opened this issue Feb 8, 2024 · 7 comments
Labels
agent-php bug Something isn't working

Comments

@Arya-Aniket
Copy link

Arya-Aniket commented Feb 8, 2024

This error is specific to open_basedir, On installing plugins I am getting 0 at the end of json

;php_admin_value[open_basedir] =
;php_admin_value[realpath_turbo.open_basedir] = /home/runcloud/webapps/app-elk-test-1:/var/lib/php/session:/tmp

Installation failed: {"success":true,"data":{"install":"plugin","slug":"contact-form-7","pluginName":"Contact Form 7","debug":["Downloading installation package from https://downloads.wordpress.org/plugin/contact-form-7.5.8.7.zip…","The authenticity of contact-form-7.5.8.7.zip could not be verified as no signature was found.","Unpacking the package…","Installing the plugin…","Plugin installed successfully."],"activateUrl":"http://app-elk-test-1.vjsfwiy08a-lxd6r7yjo49g.p.temp-site.link/wp-admin/plugins.php?_wpnonce=397a65894a&action=activate&plugin=contact-form-7/wp-contact-form-7.php"}}0

`
php74rc-fpm.service - The PHP FastCGI Process Manager
Loaded: loaded (/etc/systemd/system/php74rc-fpm.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2024-02-08 04:49:21 UTC; 10s ago
Main PID: 15787 (php-fpm)
Status: "Processes active: 0, idle: 20, Requests: 2, slow: 0, Traffic: 0.2req/sec"
Tasks: 21 (limit: 9421)
Memory: 53.4M
CGroup: /system.slice/php74rc-fpm.service
├─15787 php-fpm: master process (/etc/php74rc/php-fpm.conf)
├─15788 php-fpm: pool astra-defaults
├─15789 php-fpm: pool blueprint
├─15790 php-fpm: pool clone-my-surecart
├─15791 php-fpm: pool clone-my-surecraft
├─15792 php-fpm: pool clone-surecart-main-site
├─15793 php-fpm: pool dn-ganarator
├─15794 php-fpm: pool membershiparea
├─15795 php-fpm: pool my-store-site-copy
├─15796 php-fpm: pool ph-backup-before-launch
├─15797 php-fpm: pool phpmyadmin
├─15798 php-fpm: pool redesign-surecart-site
├─15799 php-fpm: pool spectra-editor
├─15800 php-fpm: pool surecart-clone
├─15801 php-fpm: pool surecart-demo-site
├─15802 php-fpm: pool suretriggers-app-directory
├─15803 php-fpm: pool surewriter-staging-site
├─15804 php-fpm: pool website-copy
├─15805 php-fpm: pool wpspectra-clone-site
├─15808 php-fpm: pool astra-st-dev
└─15813 php-fpm: pool wpastra-staging-060224

Feb 08 04:49:21 s29 systemd[1]: Starting The PHP FastCGI Process Manager...
Feb 08 04:49:21 s29 systemd[1]: Started The PHP FastCGI Process Manager.
Feb 08 04:49:27 s29 [15808]: [Elastic APM PHP Tracer] 2024-02-08 04:49:27.264684+00:00 [PID: 15808] [TID: 15808] [CRITICAL] [Bootstrap] [BootstrapStageLogger.php:225] [callAndSwallowThrowable] Handling ensureHaveLatestDataDeferredByExtension call let a throwable escape - skipping the rest of the steps. Error: Class 'Elastic\Apm\Impl\Util\DbgUtil' not found
Stack trace:
#0 /opt/elastic/apm-agent-php/src/ElasticApm/Impl/AutoInstrument/PhpPartFacade.php(288): Elastic\Apm\Impl\AutoInstrument\PhpPartFacade::ensureHaveLastPhpError()
#1 /opt/elastic/apm-agent-php/src/ElasticApm/Impl/AutoInstrument/PhpPartFacade.php(271): Elastic\Apm\Impl\AutoInstrument\PhpPartFacade::ensureHaveLastErrorData()
#2 /opt/elastic/apm-agent-php/src/ElasticApm/Impl/AutoInstrument/PhpPartFacade.php(261): Elastic\Apm\Impl\AutoInstrument\PhpPartFacade::Elastic\Apm\Impl\AutoInstrument{closure}()
#3 /opt/elastic/apm-agent-php/src/ElasticApm/Impl/AutoInstrument/PhpPartFacade.php(219): Elastic\Apm\Impl\AutoInstrument\PhpPartFacade::Elastic\Apm\Impl\AutoInstrument{closure}()
#4 /opt/elastic/apm-agent-php/src/ElasticApm/Impl/AutoInstrument/PhpPartFacade.php(262): Elastic\Apm\Impl\AutoInstrument\PhpPartFacade::callAndSwallowThrowable()
#5 /opt/elastic/apm-agent-php/src/ElasticApm/Impl/AutoInstrument/PhpPartFacade.php(272): Elastic\Apm\Impl\AutoInstrument\PhpPartFacade::callWithTransactionForExtensionRequest()
#6 /opt/elastic/apm-agent-php/src/ElasticApm/Impl/AutoInstrument/TransactionForExtensionRequest.php(376): Elastic\Apm\Impl\AutoInstrument\PhpPartFacade::ensureHaveLatestDataDeferredByExtension()
#7 /opt/elastic/apm-agent-php/src/ElasticApm/Impl/AutoInstrument/PhpPartFacade.php(478): Elastic\Apm\Impl\AutoInstrument\TransactionForExtensionRequest->onShutdown()
#8 /opt/elastic/apm-agent-php/src/ElasticApm/Impl/AutoInstrument/PhpPartFacade.php(261): Elastic\Apm\Impl\AutoInstrument\PhpPartFacade::Elastic\Apm\Impl\AutoInstrument{closure}()
#9 /opt/elastic/apm-agent-php/src/ElasticApm/Impl/AutoInstrument/PhpPartFacade.php(219): Elastic\Apm\Impl\AutoInstrument\PhpPartFacade::Elastic\Apm\Impl\AutoInstrument{closure}()
#10 /opt/elastic/apm-agent-php/src/ElasticApm/Impl/AutoInstrument/PhpPartFacade.php(262): Elastic\Apm\Impl\AutoInstrument\PhpPartFacade::callAndSwallowThrowable()
#11 /opt/elastic/apm-agent-php/src/ElasticApm/Impl/AutoInstrument/PhpPartFacade.php(479): Elastic\Apm\Impl\AutoInstrument\PhpPartFacade::callWithTransactionForExtensionRequest()
#12 [internal function]: Elastic\Apm\Impl\AutoInstrument\PhpPartFacade::shutdown()
#13 {main}
Feb 08 04:49:27 s29 [15808]: [Elastic APM PHP Tracer] 2024-02-08 04:49:27.265015+00:00 [PID: 15808] [TID: 15808] [CRITICAL] [Bootstrap] [BootstrapStageLogger.php:225] [callAndSwallowThrowable] Handling shutdown call let a throwable escape - skipping the rest of the steps. Error: Class 'Elastic\Apm\Impl\ErrorExceptionData' not found
Stack trace:
#0 /opt/elastic/apm-agent-php/src/ElasticApm/Impl/Tracer.php(356): Elastic\Apm\Impl\Tracer->createError()
#1 /opt/elastic/apm-agent-php/src/ElasticApm/Impl/AutoInstrument/TransactionForExtensionRequest.php(318): Elastic\Apm\Impl\Tracer->createErrorFromThrowable()
#2 /opt/elastic/apm-agent-php/src/ElasticApm/Impl/AutoInstrument/TransactionForExtensionRequest.php(388): Elastic\Apm\Impl\AutoInstrument\TransactionForExtensionRequest->beforeHttpEnd()
#3 /opt/elastic/apm-agent-php/src/ElasticApm/Impl/AutoInstrument/PhpPartFacade.php(478): Elastic\Apm\Impl\AutoInstrument\TransactionForExtensionRequest->onShutdown()
#4 /opt/elastic/apm-agent-php/src/ElasticApm/Impl/AutoInstrument/PhpPartFacade.php(261): Elastic\Apm\Impl\AutoInstrument\PhpPartFacade::Elastic\Apm\Impl\AutoInstrument{closure}()
#5 /opt/elastic/apm-agent-php/src/ElasticApm/Impl/AutoInstrument/PhpPartFacade.php(219): Elastic\Apm\Impl\AutoInstrument\PhpPartFacade::Elastic\Apm\Impl\AutoInstrument{closure}()
#6 /opt/elastic/apm-agent-php/src/ElasticApm/Impl/AutoInstrument/PhpPartFacade.php(262): Elastic\Apm\Impl\AutoInstrument\PhpPartFacade::callAndSwallowThrowable()
#7 /opt/elastic/apm-agent-php/src/ElasticApm/Impl/AutoInstrument/PhpPartFacade.php(479): Elastic\Apm\Impl\AutoInstrument\PhpPartFacade::callWithTransactionForExtensionRequest()
#8 [internal function]: Elastic\Apm\Impl\AutoInstrument\PhpPartFacade::shutdown()
#9 {main}`

@intuibase
Copy link
Contributor

Hey @Arya-Aniket

Did you tried to add /opt/elastic/apm-agent-php to realpath_turbo.open_basedir or open_basedir?

@Arya-Aniket
Copy link
Author

Arya-Aniket commented Feb 14, 2024

@intuibase

I have tried that now I am getting 0 out of know where in admin-ajax.php on wordpress after json

{
"success": true,
"data": {
"count": 1,
"items": "<input type="hidden" name="_wp_http_referer" value="/wp-admin/plugin-install.php?s=woom&tab=search&type=term&pagenow=plugin-install" />\t\t\t<div class="tablenav top">\n\t\t\t\t<div class="alignleft actions">\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t

<span class="displaying-num">1 item</span>\n<span class="tablenav-pages-navspan button disabled" aria-hidden="true">«</span>\n<span class="tablenav-pages-navspan button disabled" aria-hidden="true">‹</span>\n<span class="paging-input"><label for="current-page-selector" class="screen-reader-text">Current Page</label><input class='current-page' id='current-page-selector' type='text'\n\t\t\t\t\tname='paged' value='1' size='1' aria-describedby='table-paging' /> of 1</span></span></span>\n<span class="tablenav-pages-navspan button disabled" aria-hidden="true">›</span>\n<span class="tablenav-pages-navspan button disabled" aria-hidden="true">»</span></span></div>\t\t\t\t<br class="clear" />\n\t\t\t</div>\n\t\t<div class="wp-list-table widefat plugin-install">\n\t\t\t<div id="the-list">\n\t\t\t\t<div class="plugin-card plugin-card-wooms">\n\t\t\t<div class="notice notice-error notice-alt inline">

This plugin does not work with your version of PHP. <a href="https://wordpress.org/support/update-php/">Learn more about updating PHP</a>.</p></div>\t\t\t<div class="plugin-card-top">\n\t\t\t\t<div class="name column-name">\n\t\t\t\t\t

\n\t\t\t\t\t\t<a href="https://accessible-ajax-nls4.stagesite.top/wp-admin/plugin-install.php?tab=plugin-information&plugin=wooms&TB_iframe=true&width=600&height=550" class="thickbox open-plugin-details-modal">\n\t\t\t\t\t\tWooMS\t\t\t\t\t\t<img src="https://ps.w.org/wooms/assets/icon-256x256.jpg?rev=2826440" class="plugin-icon" alt="" />\n\t\t\t\t\t\t</a>\n\t\t\t\t\t</h3>\n\t\t\t\t</div>\n\t\t\t\t<div class="action-links">\n\t\t\t\t\t<ul class="plugin-action-buttons">
  • <button type="button" class="button button-disabled" disabled="disabled">Cannot Install</button></li>
  • <a href="https://accessible-ajax-nls4.stagesite.top/wp-admin/plugin-install.php?tab=plugin-information&plugin=wooms&TB_iframe=true&width=600&height=550" class="thickbox open-plugin-details-modal" aria-label="More information about WooMS 9.10" data-title="WooMS 9.10">More Details</a></li></ul>\t\t\t\t</div>\n\t\t\t\t<div class="desc column-description">\n\t\t\t\t\t

    MoySklad (moysklad.ru) and WooCommerce - sync, integration, connection</p>\n\t\t\t\t\t<p class="authors"> By <a href="https://wpcraft.ru/">WPCraft</a></cite></p>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div class="plugin-card-bottom">\n\t\t\t\t<div class="vers column-rating">\n\t\t\t\t\t<div class="star-rating"><span class="screen-reader-text">4.0 rating based on 22 ratings</span><div class="star star-full" aria-hidden="true"></div><div class="star star-full" aria-hidden="true"></div><div class="star star-full" aria-hidden="true"></div><div class="star star-full" aria-hidden="true"></div><div class="star star-empty" aria-hidden="true"></div></div>\t\t\t\t\t<span class="num-ratings" aria-hidden="true">(22)</span>\n\t\t\t\t</div>\n\t\t\t\t<div class="column-updated">\n\t\t\t\t\tLast Updated:</strong>\n\t\t\t\t\t2 months ago\t\t\t\t</div>\n\t\t\t\t<div class="column-downloaded">\n\t\t\t\t\t700+ Active Installations\t\t\t\t</div>\n\t\t\t\t<div class="column-compatibility">\n\t\t\t\t\t<span class="compatibility-compatible">Compatible</strong> with your version of WordPress</span>\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t\t\t\t</div>\n</div>\n\t\t\t\t\t<div class="tablenav bottom">\n\t\t\t\t

    <span class="displaying-num">1 item</span>\n<span class="tablenav-pages-navspan button disabled" aria-hidden="true">«</span>\n<span class="tablenav-pages-navspan button disabled" aria-hidden="true">‹</span>\n<span class="screen-reader-text">Current Page</span><span id="table-paging" class="paging-input"><span class="tablenav-paging-text">1 of 1</span></span></span>\n<span class="tablenav-pages-navspan button disabled" aria-hidden="true">›</span>\n<span class="tablenav-pages-navspan button disabled" aria-hidden="true">»</span></span></div>\t\t\t\t<br class="clear" />\n\t\t\t</div>\n\t\t\t"
    }
    }0

    this issue coming from this file:

    root@zwp-server:~# nano /opt/elastic/apm-agent-php/src/ElasticApm/Impl/Util/JsonUtil.php ;
    root@zwp-server:~# cat /opt/elastic/apm-agent-php/src/ElasticApm/Impl/Util/JsonUtil.php -n
         1  <?php
         2
         3  /*
         4   * Licensed to Elasticsearch B.V. under one or more contributor
         5   * license agreements. See the NOTICE file distributed with
         6   * this work for additional information regarding copyright
         7   * ownership. Elasticsearch B.V. licenses this file to you under
         8   * the Apache License, Version 2.0 (the "License"); you may
         9   * not use this file except in compliance with the License.
        10   * You may obtain a copy of the License at
        11   *
        12   *     http://www.apache.org/licenses/LICENSE-2.0
        13   *
        14   * Unless required by applicable law or agreed to in writing,
        15   * software distributed under the License is distributed on an
        16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
        17   * KIND, either express or implied.  See the License for the
        18   * specific language governing permissions and limitations
        19   * under the License.
        20   */
        21
        22  declare(strict_types=1);
        23
        24  namespace Elastic\Apm\Impl\Util;
        25
        26  /**
        27   * Code in this file is part of implementation internals and thus it is not covered by the backward compatibility.
        28   *
        29   * @internal
        30   */
        31  final class JsonUtil
        32  {
        33      use StaticClassTrait;
        34
        35      /**
        36       * @param mixed $data
        37       * @param bool  $prettyPrint
        38       *
        39       * @return string
        40       *
        41       * @throws JsonException
        42       */
        43      public static function encode($data, bool $prettyPrint = false): string
        44      {
        45          $options = JSON_INVALID_UTF8_SUBSTITUTE;
        46          $options |= $prettyPrint ? JSON_PRETTY_PRINT : 0;
        47          $encodedData = json_encode($data, $options);
        48          if ($encodedData === false) {
        49              throw new JsonException(
        50                  'json_encode() failed'
        51                  . '. json_last_error_msg(): ' . json_last_error_msg()
        52                  . '. dataType: ' . DbgUtil::getType($data)
        53              );
        54          }
        55          return $encodedData;
        56      }
        57  }
    
  • @Arya-Aniket
    Copy link
    Author

    Arya-Aniket commented Feb 14, 2024

    @intuibase
    resolve this by removing : 0

    public static function encode($data, bool $prettyPrint = false): string
            {
             $options = JSON_INVALID_UTF8_SUBSTITUTE;
              $options |= $prettyPrint ? JSON_PRETTY_PRINT : {}; // original code => $options |= $prettyPrint ? JSON_PRETTY_PRINT : 0;
           $encodedData = json_encode($data, $options);
             if ($encodedData === false) {
                throw new JsonException(
                 'json_encode() failed'
                  . '. json_last_error_msg(): ' . json_last_error_msg()
                    . '. dataType: ' . DbgUtil::getType($data)
             );
         }
            return $encodedData;
          }
    

    @Arya-Aniket
    Copy link
    Author

    Arya-Aniket commented Feb 22, 2024

    @intuibase @pierrehilbert
    /opt/elastic/apm-agent-php/src/ElasticApm/Impl/Util/JsonUtil.php
    Can you please help me with this

    @pierrehilbert
    Copy link

    Unfortunately I'm not familiar with the APM Agent for PHP.
    @intuibase should be able to help you.

    @SergeyKleyman
    Copy link
    Contributor

    Hi @Arya-Aniket Could you please try the latest agent version. We fixed issue #1120 which is related to JSON encoding done by the agent.

    @SergeyKleyman SergeyKleyman added the bug Something isn't working label Mar 26, 2024
    @Arya-Aniket
    Copy link
    Author

    Arya-Aniket commented Apr 1, 2024

    @SergeyKleyman I tried, but getting error while using page editor.

    Receiving 0 at the end of every api response json.

    {
    "success": true,
    "data": {
    "count": 67,
    "items": ""
    }
    }0

    1. Error
      Notice: Undefined variable: 2097152 in /opt/elastic/apm-agent-php/src/ElasticApm/Impl/Util/JsonUtil.php on line 47

    Notice: Undefined variable: 2097152 in /opt/elastic/apm-agent-php/src/ElasticApm/Impl/Util/JsonUtil.php on line 47

    1. Error
      runcloud@Test-Elk-Server:~/webapps/app-conroy$ tail -f wp-content/debug.log
      Manual Instrumentation #4 /opt/elastic/apm-agent-php/src/ElasticApm/Impl/ExecutionSegment.php(578): Elastic\Apm\Impl\Tracer->sendSpanToApmServer()
      Load Generator #5 /opt/elastic/apm-agent-php/src/ElasticApm/Impl/Span.php(488): Elastic\Apm\Impl\ExecutionSegment->onChildSpanEnded()
      Preliminaries and ini tidy up #6 /opt/elastic/apm-agent-php/src/ElasticApm/Impl/AutoInstrument/Util/AutoInstrumentationUt in /opt/elastic/apm-agent-php/src/ElasticApm/Impl/Util/JsonUtil.php on line 49
      [22-Feb-2024 13:52:47 UTC] PHP Warning: Cannot modify header information - headers already sent by (output started at /opt/elastic/apm-agent-php/src/ElasticApm/Impl/Util/JsonUtil.php:21) in /home/runcloud/webapps/app-conroy/wp-admin/includes/misc.php on line 1431
      [22-Feb-2024 13:52:47 UTC] PHP Warning: Cannot modify header information - headers already sent by (output started at /opt/elastic/apm-agent-php/src/ElasticApm/Impl/Util/JsonUtil.php:21) in /home/runcloud/webapps/app-conroy/wp-includes/functions.php on line 7049
      [22-Feb-2024 13:52:47 UTC] PHP Warning: Cannot modify header information - headers already sent by (output started at /opt/elastic/apm-agent-php/src/ElasticApm/Impl/Util/JsonUtil.php:21) in /home/runcloud/webapps/app-conroy/wp-admin/admin-header.php on line 9
      [01-Apr-2024 12:14:43 UTC] PHP Warning: Cannot modify header information - headers already sent by (output started at /home/runcloud/webapps/app-conroy/wp-includes/rest-api/class-wp-rest-server.php:556) in /home/runcloud/webapps/app-conroy/wp-includes/pluggable.php on line 1435
      [01-Apr-2024 12:14:43 UTC] PHP Warning: Cannot modify header information - headers already sent by (output started at /home/runcloud/webapps/app-conroy/wp-includes/rest-api/class-wp-rest-server.php:556) in /home/runcloud/webapps/app-conroy/wp-includes/pluggable.php on line 1438
      [01-Apr-2024 12:14:48 UTC] PHP Warning: Cannot modify header information - headers already sent by (output started at /home/runcloud/webapps/app-conroy/wp-includes/rest-api/class-wp-rest-server.php:556) in /home/runcloud/webapps/app-conroy/wp-includes/pluggable.php on line 1435
      [01-Apr-2024 12:14:48 UTC] PHP Warning: Cannot modify header information - headers already sent by (output started at /home/runcloud/webapps/app-conroy/wp-includes/rest-api/class-wp-rest-server.php:556) in /home/runcloud/webapps/app-conroy/wp-includes/pluggable.php on line 1438

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    agent-php bug Something isn't working
    Projects
    None yet
    Development

    No branches or pull requests

    4 participants