# PHP APM Error

**URL:** <https://discuss.elastic.co/t/php-apm-error/267044>\
**Category:** APM\
**Tags:** php\
**Created:** [March 12, 2021, 6:55am UTC](https://discuss.elastic.co/t/php-apm-error/267044 "2021-03-12T06:55:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![eric\_llistar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eric_llistar/32/85435_2.png) [@eric\_llistar](https://discuss.elastic.co/u/eric_llistar)\
**Post date:** [March 12, 2021, 6:55am UTC](https://discuss.elastic.co/t/php-apm-error/267044/1 "2021-03-12T06:55:54Z")

</div>

**Kibana version** :

- v7.11.2  
**Elasticsearch version** :
- v7.11.2  
**APM Server version** :
- v7.11.2  
**APM Agent language and version** :  
PHP 1.0 Beta  
**Browser version** :  
Safari 14  
**Original install method (e.g. download page, yum, deb, from source, etc.) and version**:  
Downloaded package from elastic web  
**Fresh install or upgraded from other version?**  
Fresh install

**Description of the problem including expected versus actual behavior. Please include screenshots (if relevant)**:

I've followed the steps to install and configure php agent on a machine, but this is unable to send information to Elastic APM  
This is my php.ini config:

```auto
[elasticAPM]
elastic_apm.enabled=true
elastic_apm.server_url=cloud server
elastic_apm.secret_token=xxxxxxxxxxx
elastic_apm.service_name="PHP"
; THIS IS AN AUTO-GENERATED FILE by the Elastic PHP agent post-install.sh script
extension=/opt/elastic/apm-agent-php/extensions/elastic_apm-20190902.so
elastic_apm.bootstrap_php_part_file=/opt/elastic/apm-agent-php/src/bootstrap_php_part.php
; END OF AUTO-GENERATED by the Elastic PHP agent post-install.sh script

```

And also auto\_globals\_jit = Off

**Steps to reproduce** :  
1.Install agent  
2.configure php.ini  
3.restart apache

**Errors in php agent** :

```auto
  % Total % Received % Xferd Average Speed Time Time Time Current
                                 Dload Upload Total Spent Left Speed
  0 244 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
  % Total % Received % Xferd Average Speed Time Time Time Current
                                 Dload Upload Total Spent Left Speed
  0 244 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
  % Total % Received % Xferd Average Speed Time Time Time Current
                                 Dload Upload Total Spent Left Speed
  0 244 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
  % Total % Received % Xferd Average Speed Time Time Time Current
                                 Dload Upload Total Spent Left Speed
  0 244 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
  % Total % Received % Xferd Average Speed Time Time Time Current
                                 Dload Upload Total Spent Left Speed
  0 244 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0

▽
  % Total % Received % Xferd Average Speed Time Time Time Current
                                 Dload Upload Total Spent Left Speed
  0 244 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
  % Total % Received % Xferd Average Speed Time Time Time Current
                                 Dload Upload Total Spent Left Speed
  0 244 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
  % Total % Received % Xferd Average Speed Time Time Time Current
                                 Dload Upload Total Spent Left Speed
  0 244 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
  % Total % Received % Xferd Average Speed Time Time Time Current
                                 Dload Upload Total Spent Left Speed
  0 244 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0

2021-03-12 03:19:01.876613+01:00 [CRITICAL] [Bootstrap] [BootstrapStageLogger.php:170] [shutdown] One of the steps in shutdown sequence let a throwable escape - skipping the rest of the steps. Elastic\Apm\Impl\BackendComm\SerializationException: Serialization failed. JsonUtil::encode() failed. {"$jsonEncodable type":"array","causedBy":{"type":"Elastic\\Apm\\Impl\\Util\\JsonException","value_as_string":"Elastic\\Apm\\Impl\\Util\\JsonException: json_encode() failed. json_last_error_msg(): Malformed UTF-8 characters, possibly incorrectly encoded. dataType: array in \/opt\/elastic\/apm-agent-php\/src\/ElasticApm\/Impl\/Util\/JsonUtil.php:30\nStack trace:\n#0 \/opt\/elastic\/apm-agent-php\/src\/ElasticApm\/Impl\/Log\/LoggableToEncodedJson.php(44): Elastic\\Apm\\Impl\\Util\\JsonUtil::encode(Array, true)\n#1 \/opt\/elastic\/apm-agent-php\/src\/ElasticApm\/Impl\/Log\/LoggableToString.php(32): Elastic\\Apm\\Impl\\Log\\LoggableToEncodedJson::convert(Object(Elastic\\Apm\\Impl\\Log\\AdhocLoggableObject), true, 1000)\n#2 \/opt\/elastic\/apm-agent-php\/src\/ElasticApm\/Impl\/Util\/ExceptionUtil.php(41): Elastic\\Apm\\Impl\\Log\\LoggableToString::convert(Object(Elastic\\Apm\\Impl\\Log\\AdhocLoggableObject), true)\n#3 \/opt\/elastic\/apm-agent-php\/src\/ElasticApm\/Impl\/BackendComm\/SerializationUtil.php(36): Elastic\\Apm\\Impl\\Util\\ExceptionUtil::buildMessage('Serialization f...', Array)\n#4 \/opt\/elastic\/apm-agent-php\/src\/ElasticApm\/Impl\/BackendComm\/EventSender.php(51): Elastic\\Apm\\Impl\\BackendComm\\SerializationUtil::serializeAsJson(Object(Elastic\\Apm\\Impl\\SpanData))\n#5 \/opt\/elastic\/apm-agent-php\/src\/ElasticApm\/Impl\/Tracer.php(328): Elastic\\Apm\\Impl\\BackendComm\\EventSender->consume(Object(Elastic\\Apm\\Impl\\Metadata), Array, Array, Object(Elastic\\Apm\\Impl\\TransactionData))\n#6 \/opt\/elastic\/apm-agent-php\/src\/ElasticApm\/Impl\/Transaction.php(383): Elastic\\Apm\\Impl\\Tracer->sendEventsToApmServer(Array, Array, Object(Elastic\\Apm\\Impl\\TransactionData))\n#7 \/opt\/elastic\/apm-agent-php\/src\/ElasticApm\/Impl\/AutoInstrument\/TransactionForExtensionRequest.php(67): Elastic\\Apm\\Impl\\Transaction->end()\n#8 \/opt\/elastic\/apm-agent-php\/src\/ElasticApm\/Impl\/AutoInstrument\/PhpPartFacade.php(182): Elastic\\Apm\\Impl\\AutoInstrument\\TransactionForExtensionRequest->onShutdown()\n#9 \/opt\/elastic\/apm-agent-php\/src\/ElasticApm\/Impl\/AutoInstrument\/PhpPartFacade.php(165): Elastic\\Apm\\Impl\\AutoInstrument\\PhpPartFacade->shutdownImpl()\n#10 [internal function]: Elastic\\Apm\\Impl\\AutoInstrument\\PhpPartFacade::shutdown()\n#11 {main}"}}
2021-03-12 03:19:01.876613+01:00 [CRITICAL] [Bootstrap] [BootstrapStageLogger.php:170] [shutdown] Stack trace:
2021-03-12 03:19:01.876613+01:00 [CRITICAL] [Bootstrap] [BootstrapStageLogger.php:170] [shutdown] #0 /opt/elastic/apm-agent-php/src/ElasticApm/Impl/BackendComm/EventSender.php(51): Elastic\Apm\Impl\BackendComm\SerializationUtil::serializeAsJson(Object(Elastic\Apm\Impl\SpanData))
2021-03-12 03:19:01.876613+01:00 [CRITICAL] [Bootstrap] [BootstrapStageLogger.php:170] [shutdown] #1 /opt/elastic/apm-agent-php/src/ElasticApm/Impl/Tracer.php(328): Elastic\Apm\Impl\BackendComm\EventSender->consume(Object(Elastic\Apm\Impl\Metadata), Array, Array, Object(Elastic\Apm\Impl\TransactionData))
2021-03-12 03:19:01.876613+01:00 [CRITICAL] [Bootstrap] [BootstrapStageLogger.php:170] [shutdown] #2 /opt/elastic/apm-agent-php/src/ElasticApm/Impl/Transaction.php(383): Elastic\Apm\Impl\Tracer->sendEventsToApmServer(Array, Array, Object(Elastic\Apm\Impl\TransactionData))
2021-03-12 03:19:01.876613+01:00 [CRITICAL] [Bootstrap] [BootstrapStageLogger.php:170] [shutdown] #3 /opt/elastic/apm-agent-php/src/ElasticApm/Impl/AutoInstrument/TransactionForExtensionRequest.php(67): Elastic\Apm\Impl\Transaction->end()
2021-03-12 03:19:01.876613+01:00 [CRITICAL] [Bootstrap] [BootstrapStageLogger.php:170] [shutdown] #4 /opt/elastic/apm-agent-php/src/ElasticApm/Impl/AutoInstrument/PhpPartFacade.php(182): Elastic\Apm\Impl\AutoInstrument\TransactionForExtensionRequest->onShutdown()
2021-03-12 03:19:01.876613+01:00 [CRITICAL] [Bootstrap] [BootstrapStageLogger.php:170] [shutdown] #5 /opt/elastic/apm-agent-php/src/ElasticApm/Impl/AutoInstrument/PhpPartFacade.php(165): Elastic\Apm\Impl\AutoInstrument\PhpPartFacade->shutdownImpl()
2021-03-12 03:19:01.876613+01:00 [CRITICAL] [Bootstrap] [BootstrapStageLogger.php:170] [shutdown] #6 [internal function]: Elastic\Apm\Impl\AutoInstrument\PhpPartFacade::shutdown()
2021-03-12 03:19:01.876613+01:00 [CRITICAL] [Bootstrap] [BootstrapStageLogger.php:170] [shutdown] #7 {main}

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 2, 2021, 2:56am UTC](https://discuss.elastic.co/t/php-apm-error/267044/2 "2021-04-02T02:56:18Z")

</div>

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