Skip to content
Native Extension Component for ScoutAPM's PHP Agent
C PHP M4 Shell CMake Dockerfile
Branch: master
Clone or download
asgrim Merge pull request #54 from scoutapp/53-optionally-compile-with-curl-…

Optionally compile with curl support
Latest commit 1e9b7fb Nov 8, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci Move all additional sys packages into environment variable to avoid (… Nov 8, 2019
tests Skip curl test if curl_exec is not an instrumented function Nov 8, 2019
CMakeLists.txt Added support for returning query executed from PDOStatement->execute() Oct 31, 2019
CREDITS Added CREDITS and EXPERIMENTAL marker Sep 17, 2019
LICENSE Create LICENSE (MIT) Sep 3, 2019 Re-ordered the release process to a more sensible order Nov 4, 2019 Make it a zend_extension again in case we need potential future funct… Sep 11, 2019
config.m4 Add a warning message to configure when curl headers not found Nov 8, 2019
package.xml Added changelog entry for PR #54 Nov 8, 2019
scout_curl_wrapper.c Make the dependency on curl optional so users without curl can still … Nov 8, 2019
scout_extern.h Determine unique names for resources used for stored argument lookups Oct 31, 2019
scout_pdo_wrapper.c Removed unnecessary duplicate checks for negativity Nov 1, 2019
zend_scoutapm.c Added function to fetch the list of functions we actually instrument Nov 8, 2019
zend_scoutapm.h Added function to fetch the list of functions we actually instrument Nov 8, 2019

Scout APM PHP Extension


The Scout APM PHP extension allows instrumentation of internal PHP functions that can't be done in regular PHP. The scout-apm-php package detects if the scoutapm extension is loaded and will automatically send this data if available.

Functions currently instrumented are:

  • file_get_contents
  • file_put_contents
  • curl_exec
  • fread
  • fwrite
  • PDO->exec
  • PDO->query
  • PDOStatement->execute

If you would like another function instrumented, please let us know on our issues.

Installing from PECL

The Scout APM extension is available to install using PECL.

$ sudo pecl install scoutapm

You may need to add into your php.ini to enable the extension.


$ phpize
$ ./configure --enable-scoutapm
$ make test

Note: whilst a CMakeLists.txt exists, this project does NOT use CMake. The CMakeLists.txt exists so this project can be worked on in CLion. See

Building with specific PHP build

$ /path/to/bin/phpize
$ ./configure --with-php-config=/path/to/bin/php-config --enable-scoutapm
$ make test

Building with Docker

@todo: make docker build configurable...

docker build .
docker run -v $PWD/modules:/v <hash_from_build>


Use gdb (e.g. in CLion) to debug. Once running, php-src has a GDB helper:

source /path/to/php-src/.gdbinit
printzv <thing>
print_ht <thing>

Release Procedure

  • Open package.xml
  • Copy the current release into a new changelog.release element
  • Update the current release section (date/time/version/stability/notes)
  • pecl package-validate to check everything looks good
  • Increase/verify PHP_SCOUTAPM_VERSION version listed in zend_scoutapm.h
  • Commit update to package.xml
  • Rebuild from scratch (, then build as above)
  • make test to ensure everything passes locally
  • Push the branch (optionally, make a PR to GitHub) to trigger CI to build
  • Once passed, pecl package to generate the tgz
  • Upload to
  • Make a GPG-signed tag with git tag -s <tagversion> and enter changelog notes in tag body
  • git push origin <tagversion> to push the tag up
  • Create a release from the tag (use same changelog notes)
  • Shift the milestones along on GitHub
You can’t perform that action at this time.