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

502 error when used with ionCube loader #123

Closed
belkone opened this issue Aug 12, 2020 · 8 comments
Closed

502 error when used with ionCube loader #123

belkone opened this issue Aug 12, 2020 · 8 comments

Comments

@belkone
Copy link

belkone commented Aug 12, 2020

Is it possible to use this together with ionCube loader?

The agent doesn't work when I turn on zend_extension = ioncube_loader_lin_7.2.so in php.ini.
It is enough that the module is loaded in php.ini, tested service does not have to use ionCube to cause an error (doesn't work even with a pure php script)
Extensions loading order does not matter.

I haven't found any logs related to this case, is it possible to enable debug logs for this?
PHP 7.2 (fpm)

@SergeyKleyman
Copy link
Contributor

Could you please provide Agent logs sent to syslog?

@belkone
Copy link
Author

belkone commented Aug 20, 2020

Could you please provide Agent logs sent to syslog?

Sure, here: https://pastebin.com/AMxem6YB

@SergeyKleyman
Copy link
Contributor

Aug 20 11:02:36 test ool www: Elastic APM PHP Tracer [PID: 29658] 2020-08-20 11:02:36.471810+02:00 [DEBUG]    [C-to-PHP] [tracer_PHP_part.c:30] [bootstrapTracerPhpPart] Entered: config->bootstrapPhpPartFile: `/var/www/apm-agent-php/src/bootstrap_php_part.php'
Aug 20 11:02:36 test ool www: Elastic APM PHP Tracer [PID: 29658] 2020-08-20 11:02:36.471823+02:00 [DEBUG]    [Util] [util_for_PHP.c:27] [loadPhpFile] Entered: filename: `/var/www/apm-agent-php/src/bootstrap_php_part.php'
Aug 20 11:02:39 test systemd[1]: Stopping The PHP 7.2 FastCGI Process Manager...

It seems that C part (.so extension) of the agent cannot load PHP part (/var/www/apm-agent-php/src/bootstrap_php_part.php).

  1. Is the path /var/www/apm-agent-php/src/bootstrap_php_part.php correct?
  2. Is it possible that the user under which fpm worker is running doesn't have permissions to access /var/www/apm-agent-php/src/bootstrap_php_part.php?

@belkone
Copy link
Author

belkone commented Aug 20, 2020

Aug 20 11:02:36 test ool www: Elastic APM PHP Tracer [PID: 29658] 2020-08-20 11:02:36.471810+02:00 [DEBUG]    [C-to-PHP] [tracer_PHP_part.c:30] [bootstrapTracerPhpPart] Entered: config->bootstrapPhpPartFile: `/var/www/apm-agent-php/src/bootstrap_php_part.php'
Aug 20 11:02:36 test ool www: Elastic APM PHP Tracer [PID: 29658] 2020-08-20 11:02:36.471823+02:00 [DEBUG]    [Util] [util_for_PHP.c:27] [loadPhpFile] Entered: filename: `/var/www/apm-agent-php/src/bootstrap_php_part.php'
Aug 20 11:02:39 test systemd[1]: Stopping The PHP 7.2 FastCGI Process Manager...

It seems that C part (.so extension) of the agent cannot load PHP part (/var/www/apm-agent-php/src/bootstrap_php_part.php).

  1. Is the path /var/www/apm-agent-php/src/bootstrap_php_part.php correct?

  2. Is it possible that the user under which fpm worker is running doesn't have permissions to access /var/www/apm-agent-php/src/bootstrap_php_part.php?

  1. yes
  2. user has got right permissions, because if I unload the ioncube .so extension , the agent starts working properly - they just can't be loaded together.

@SergeyKleyman
Copy link
Contributor

I took a look on what ioncube does and I agree with you that the root cause is ioncube clashing with agent's loading of its PHP part.
Does ioncube have configuration where you can exclude certain code sources from its protection?

@belkone
Copy link
Author

belkone commented Aug 20, 2020

I don't think anything can be configured on the ioncube loader side, it works like "turn it on and forget it".
Maybe something can be done on the side of the apm agent?

@SergeyKleyman
Copy link
Contributor

I googled ioncube PHP APM and names of other vendors that have PHP APM solutions and it seems that ionCUBE Loader is not supported by those vendors neither.
Maybe the deployment approach described in #119 can be used with ionCUBE Loader but that approach will not include automatic capture of transaction and spans - it will require application/library developers to use agent's public API. If it's something that you think might work for you please leave a comment at #119. We will take users demand into account when we prioritize that issue but I cannot promise we will implement it in the near future. Of course the community can contribute implementation for that issue as well - you are welcome if you would like to give a try.

@belkone
Copy link
Author

belkone commented Aug 20, 2020

OK thanks for the information. I will look at this problem again and maybe I can find a solution - then I will let you know :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants