---
title: "Why your PHP snippet isn't running - Code Snippets"
description: "A checklist for a PHP snippet that does nothing in Joomla: status, location, conditions, access level, timing, cache, and the errors that disable it."
url: "https://www.tassos.gr/docs/code-snippets/troubleshooting/php-snippets-not-running"
date: "2026-10-23T01:21:00+00:00"
language: "en-GB"
---

[ Home ](https://www.tassos.gr/docs) / [ Code Snippets ](https://www.tassos.gr/docs/code-snippets) / [ Troubleshooting ](https://www.tassos.gr/docs/code-snippets/troubleshooting)

#  Why your PHP snippet isn't running

##  A checklist for a PHP snippet that does nothing in Joomla: status, location, conditions, access level, timing, cache, and the errors that disable it.

A PHP snippet that does nothing is almost always one of 9 things. Work through this list from the top; the first 3 catch most cases.

## [1. The snippet isn't published](#1-the-snippet-isn-t-published)

Open **Components** → **Tassos Code Snippets** and check the **Status** column. **Auto-Disabled** means the snippet failed and Code Snippets switched it off: open it, read the error at the top of the edit screen, fix the code and publish it again. [How to debug PHP errors in a snippet](https://www.tassos.gr/docs/code-snippets/troubleshooting/debug-php-errors) covers the common errors.

## [2. The Location doesn't match where you're looking](#2-the-location-doesn-t-match-where-you-re-looking)

The Location of a PHP snippet picks the client it runs in:

- **Site Page Load** runs on the frontend only.
- **Admin Page Load** runs in the administrator only.
- **Site and Admin Page Load** runs in both.

A snippet on Site Page Load never runs while you click around the administrator, and the other way round. The 2 admin locations are part of Code Snippets Pro.

## [3. A condition or the access level hides it](#3-a-condition-or-the-access-level-hides-it)

Open the **Conditional Logic** tab and check every rule. A condition that doesn't match the current page skips the snippet without any error. Then check **Access** in the sidebar: Code Snippets only loads the snippets the current visitor is allowed to view. A snippet that must react to a login, on the site or in the administrator, has to stay **Public**, because the login request comes from a guest.

## [4. The system plugin is disabled](#4-the-system-plugin-is-disabled)

Go to **System** → **Plugins** and search for *Tassos Code Snippets*. The **System - Tassos Code Snippets** plugin is what runs the snippets. With it disabled, the component still saves them but none of them execute.

## [5. Safe mode is on](#5-safe-mode-is-on)

If someone added `tcs_safe_mode` to `configuration.php` to recover from a broken snippet, every snippet is paused until that line goes. The component's pages show a warning while it's on. See [Use safe mode to recover from a snippet that locks you out](https://www.tassos.gr/docs/code-snippets/troubleshooting/safe-mode).

## [6. The output goes nowhere useful](#6-the-output-goes-nowhere-useful)

Page Load snippets run during `onAfterRoute`, before Joomla has built the page. Anything they `echo` is printed before the page's HTML, where it breaks the markup instead of showing a message. To show something, queue a message:

 ```
use Joomla\CMS\Factory;

Factory::getApplication()->enqueueMessage('The snippet ran', 'notice');
```

Output only matters for the **Shortcode** insertion method, where what the snippet echoes or returns replaces the shortcode. Shortcodes are replaced on the frontend only.

## [7. The code runs too early](#7-the-code-runs-too-early)

At `onAfterRoute` the document isn't built yet and the article text isn't loaded, so code that touches the page has nothing to work with. Wrap it in a later event, as the [Example section of the PHP snippet docs](https://www.tassos.gr/docs/code-snippets/types/php#example) shows: `onBeforeCompileHead` for the page head, `onAfterRender` for the final output, `onContentPrepare` for article text.

## [8. The code uses a blocked function](#8-the-code-uses-a-blocked-function)

Snippets that contain `exec`, `eval`, `fopen` and a few other functions never execute. The full list is in the [PHP snippet docs](https://www.tassos.gr/docs/code-snippets/types/php#security-considerations) under Security Considerations.

## [9. A cached page is served](#9-a-cached-page-is-served)

With **System - Page Cache** enabled, visitors may get a stored copy of the page, so a snippet that changes the output seems to do nothing. Clear the cache under **System** → **Clear Cache** and reload.

Still stuck? Put the `enqueueMessage` line from point 6 at the top of the snippet. If the message appears, the snippet runs and the problem is in the code below it. If it doesn't, one of the first 5 points is the cause.

 Last updated on Oct 19th 2026 10:10
