~3 min read • Updated Mar 1, 2026
1. Introduction to DirectAdmin Plugins
DirectAdmin’s plugin system allows developers to extend the control panel with custom functionality. A plugin is essentially a collection of files—scripts, HTML templates, and hook definitions—that integrate with the DirectAdmin interface.
To get started, DirectAdmin provides a sample plugin:
- hello_world.tar.gz — a simple example demonstrating plugin structure and hooks.
Plugins can:
- Add new menu items to DirectAdmin skins
- Execute custom scripts
- Send files or raw output directly to the browser
- Bypass the default DirectAdmin header/footer “bubble”
- Control HTTP headers and socket behavior
More advanced features are documented in the DirectAdmin versions system.
---2. Running PHP with a Custom php.ini
If your plugin requires a custom php.ini, you can specify it directly in the shebang line of your PHP script.
2.1 Using a Custom php.ini
#!/usr/local/bin/php -nc /usr/local/directadmin/plugins/PLUGIN_NAME/yourphp.ini
Important: The -n option disables loading of the system-wide php.ini, preventing duplicate module loading (e.g., ionCube, Zend).
2.2 Running PHP Without Any php.ini
#!/usr/local/bin/php -n
This forces PHP to use internal defaults only.
2.3 Debugging Shebang Issues
If your script fails to run, ensure it is saved in UNIX format. Convert using:
yum install dos2unix
dos2unix index.html
---
3. Using $_GET and $_POST Inside Plugins
DirectAdmin plugins run under CLI PHP (/usr/local/bin/php), which does not automatically populate $_GET and $_POST. Instead, DirectAdmin passes data through environment variables.
You can reconstruct these arrays manually:
// Build $_GET
$_GET = Array();
$QUERY_STRING = getenv('QUERY_STRING');
if ($QUERY_STRING != "") {
parse_str(html_entity_decode($QUERY_STRING), $get_array);
foreach ($get_array as $key => $value) {
$_GET[urldecode($key)] = urldecode($value);
}
}
// Build $_POST
$_POST = Array();
$POST_STRING = getenv('POST');
if ($POST_STRING != "") {
parse_str(html_entity_decode($POST_STRING), $post_array);
foreach ($post_array as $key => $value) {
$_POST[urldecode($key)] = urldecode($value);
}
}
This allows your plugin to behave similarly to a normal PHP web application.
---4. Optional Template: plugin_iframe.html
DirectAdmin supports an optional template for plugins that use:
iframe=yes
By default, DirectAdmin wraps plugin output in a hardcoded iframe layout. If you want full control over the iframe HTML, create:
/usr/local/directadmin/data/templates/custom/plugin_iframe.html
Example template:
|OUTPUT|
This is especially useful for debugging or for plugins that require custom styling.
---5. Summary
DirectAdmin’s plugin system is lightweight, flexible, and easy to extend. By combining:
- custom scripts
- custom php.ini handling
- GET/POST reconstruction
- optional iframe templates
you can build powerful integrations that feel native inside the DirectAdmin interface.
Written & researched by Dr. Shahin Siami