PHP on macOS
  • 1 Minute to read
  • Dark
    Light
  • PDF

PHP on macOS

  • Dark
    Light
  • PDF

Article summary

Download Latest PHP Profiler

M1 Support

PHP on M1 devices is supported with PHP profiler version 1.13.12 and above.

1. Get the latest Stackify PHP Profiler for Prefix:
https://download.stackify.com/stackify-php-apm/stackify-php-apm-macos-latest.tar.gz

2. Copy & extract the profiler:
copy tar.gz file to extraction directory: (example: /usr/local/stackify)

NOTE: create extraction directory if it doesn't exist:

sudo mkdir /usr/local/stackify

cd /usr/local/stackify/ && sudo cp ~/Downloads/stackify-php-apm-macos-latest.tar.gz ./stackify-php-apm-latest.tar.gz && sudo tar -zxvf stackify-php-apm-latest.tar.gz

PHP untar extension.png

Auto Install Script

Run the included install script:

sudo bash ./install.sh

Manual Install

Get PHP Config information

Because every system is setup differently, phpinfo() is commonly used to check configuration settings and for available predefined variables on a given system.
Example PHP Info.png

read more about phpinfo at php.net

Specifically you'll need:

  1. php version
    PHP version.png

  2. php.ini location
    PHP ini locations.png

  3. php extensions directory
    PHP extension directory (Core).png

Install the PHP profiler

1. Navigate to your PHP extensions directory: (found in your phpinfo)

cd /extension_dir/from/php.ini (example: /usr/local/lib/php/pecl)

2. Copy Stackify files to your PHP extensions directory:

cp /usr/local/stackify/macos/stackify-7.4.so ./stackify.so
Important:

use the extension for your matching PHP version (i.e. stackify-7.4.so)

cp /usr/local/stackify/Stackify.php ./Stackify.php

3. Add the extension to your php.ini:
Navigate to your php.ini file (found in your phpinfo) and add the following settings:

[stackify]
extension=stackify.so
stackify.application_name=My PHP Application
stackify.environment_name=Development
stackify.prefix_enabled=1
Dedicated stackify.ini file:

Alternatively, instead of editing your global php.ini file you can add these settings to an isolated stackify.ini file. This file should be placed in the directory found in the Scan this dir for additional .ini files section of your phpinfo (example: /usr/local/etc/php/7.4/conf.d)

Verify the profiler is installed

reload your phpinfo page and you should now see the [Stackify] section has been added with your configuration details:
PHP stackify extension (Stackify).png


Was this article helpful?

What's Next