---
title: "Advanced PHP Configuration"
slug: "php-advanced-configuration"
updated: 2020-08-20T19:46:19Z
published: 2020-08-20T19:46:20Z
---

> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stackify.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Advanced PHP Configuration

## PHP CLI Support

The Stackify PHP Profiler can be used to track PHP CLI applications. Update your `php.ini` to include the following:

```
stackify.monitor_cli=true
```

Each execution of a PHP script will create a new transaction in Retrace. The transaction name defaults to the PHP script filename; this can be adjusted by including the following in your PHP script file:

```
if (class_exists('Stackify\Profiler')) {
    \Stackify\Profiler::setTransactionName('Custom Transaction Name');
}
```

 **PHP CLI** applications are tracked in Retrace at **Monitoring > Other Apps**.  You must use the **Add App** button to add your application.

                         

## Custom Transaction Name

The Stackify PHP Profiler identifies and names transactions based on the application framework. In some cases this may not be the value you want associated with your transaction. Use the following code inside your application to customize the transaction name:

```
if (class_exists('Stackify\Profiler')) {
    \Stackify\Profiler::setTransactionName('Custom Transaction Name');
}
```

## PHP auto_prepend Support

If you are using the PHP `auto_prepend_file` feature, update your `php.ini` to include the following:

```
stackify.auto_prepend_library=1
```

## PHP Application per Folder Support

If you are running multiple applications (each in a separate folder), additional configuration is required to correctly set the **Application Name** and **Environment Name**.

### Apache

Add or update a `.htaccess` file in your application directory with the following contents:

```
php_value stackify.application_name "PHP Application"
php_value stackify.environment_name "Production"
```

### Nginx

Update your Nginx server configuration to include the following:

```
location /application {
   fastcgi_param PHP_VALUE 'stackify.application_name="PHP Application";\nstackify.environment_name="Production";';
}
```

## Verbose Trace Details

The Stackify PHP Profiler can be setup to track all method calls to help debug or setup custom instrumentation. Update your `php.ini` to include the following:

```
stackify.track_all_enabled=1
```
