Open Arya-Aniket opened 9 months ago
Hey @Arya-Aniket
Did you tried to add /opt/elastic/apm-agent-php
to realpath_turbo.open_basedir
or open_basedir
?
@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
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
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 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 }
@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;
}
@intuibase @pierrehilbert /opt/elastic/apm-agent-php/src/ElasticApm/Impl/Util/JsonUtil.php Can you please help me with this
Unfortunately I'm not familiar with the APM Agent for PHP. @intuibase should be able to help you.
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 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
Notice: Undefined variable: 2097152 in /opt/elastic/apm-agent-php/src/ElasticApm/Impl/Util/JsonUtil.php on line 47
[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
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()
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()