# Elastic APM PHP Tracer - Sending events to APM Server failed

**URL:** <https://discuss.elastic.co/t/elastic-apm-php-tracer-sending-events-to-apm-server-failed/260445>\
**Category:** APM\
**Tags:** php\
**Created:** [January 7, 2021, 1:34pm UTC](https://discuss.elastic.co/t/elastic-apm-php-tracer-sending-events-to-apm-server-failed/260445 "2021-01-07T13:34:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bimanarajesh](https://avatars.discourse-cdn.com/v4/letter/b/eada6e/32.png) [@bimanarajesh](https://discuss.elastic.co/u/bimanarajesh)\
**Post date:** [January 7, 2021, 1:34pm UTC](https://discuss.elastic.co/t/elastic-apm-php-tracer-sending-events-to-apm-server-failed/260445/1 "2021-01-07T13:34:26Z")

</div>

**Elasticsearch version:**

6.8.4

**APM Server version:**

7.6.0

**APM Agent language and version:**

apm-agent-php 1.0.0-beta1

**PHP version:**

7.2.34

**Original install method (e.g. download page, yum, deb, from source, etc.) and version:**

Using RPM package (apm-agent-php-1.0.0\_beta1-1.noarch.rpm)

**Fresh install or upgraded from other version?**

Fresh install

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

Hi,

I followed the docs at [https://www.elastic.co/guide/en/apm/agent/php/current/intro.html](https://www.elastic.co/guide/en/apm/agent/php/current/intro.html) to attach the elastic-apm-php agent to my application and added the configurations to the php.ini file. When I run my application I get the following error:-

`Elastic APM PHP Tracer [PID: 4790] 2021-01-07 13:10:22.365282+00:00 [ERROR] `[Backend-Comm] [backend\_comm.c:161] [sendEventsToApmServer] Sending events to `APM Server failed. URL: `http://localhost:8200/intake/v2/events'. Error message: `Couldn't connect to server.

The apm-server is reachable from the application instance, the trace data for java-agent is visible and I get the above error only for php-agent .

Kindly help me resolve this issue.

Thank You

**Steps to reproduce:**

1.Followed PHP agent docs.  
2.restarted httpd  
3.restarted apm-server

---

<div class="post-metadata">

**Author:** ![Sergey\_Kleyman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sergey_kleyman/32/39333_2.png) [@Sergey\_Kleyman](https://discuss.elastic.co/u/Sergey_Kleyman)\
**Post date:** [January 11, 2021, 1:09pm UTC](https://discuss.elastic.co/t/elastic-apm-php-tracer-sending-events-to-apm-server-failed/260445/2 "2021-01-11T13:09:38Z")

</div>

Hi @bimanarajesh - welcome back to the forums 🙂

Could please clarify if APM Server is running at localhost:8200 or a different address:port? If it is the latter did you configure [`server_url`](https://www.elastic.co/guide/en/apm/agent/php/current/configuration-reference.html#config-server-url) (for example by setting `elastic_apm.server_url` in `php.ini`)?

---

<div class="post-metadata">

**Author:** ![bimanarajesh](https://avatars.discourse-cdn.com/v4/letter/b/eada6e/32.png) [@bimanarajesh](https://discuss.elastic.co/u/bimanarajesh)\
**Post date:** [January 12, 2021, 7:19am UTC](https://discuss.elastic.co/t/elastic-apm-php-tracer-sending-events-to-apm-server-failed/260445/3 "2021-01-12T07:19:53Z")

</div>

Hi @Sergey_Kleyman ,

The APM Server is running on a different IP address. The port 8200 and the server is accessible from the client instance.  
Yes, I did set the elastic\_apm.server\_url in php.ini file.

Elastic APM PHP Tracer [PID: 4790] 2021-01-07 13:10:22.365282+00:00 [ERROR] [Backend-Comm] [backend\_comm.c:161] [sendEventsToApmServer] Sending events to APM Server failed. URL: `http://ip:8200/intake/v2/events'. Error message: `Couldn't connect to server'.

---

<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:** [February 2, 2021, 3:20am UTC](https://discuss.elastic.co/t/elastic-apm-php-tracer-sending-events-to-apm-server-failed/260445/4 "2021-02-02T03:20:04Z")

</div>

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