PHP Disabled Functions: Troubleshooting Guide
Overview
For security reasons, certain PHP functions are disabled on Freethought hosting servers. These are typically system-level functions that allow PHP scripts to execute commands directly on the server. If your script relies on one of these functions, you may see an error when running it.
This is most common when migrating a website from another host or from cPanel to ULTRA Cloud, as different servers have different security configurations.
Common error messages
You may encounter one of the following errors in your browser or error logs:
Fatal error: Call to undefined function shell_exec()Warning: exec() has been disabled for security reasonsFatal error: Call to undefined function system()Warning: passthru() has been disabled for security reasons
These all indicate that the function your script is trying to use has been disabled at the server level.
Why are these functions disabled?
Functions like exec, shell_exec, system, and passthru allow PHP scripts to run operating system commands directly on the server. On shared and managed hosting environments, these are disabled by default because:
- They pose a significant security risk if a site is compromised
- A malicious script could use them to access other accounts on the server
- They can be exploited to install malware, send spam, or damage the server
This is standard security practice across the hosting industry and is not specific to Freethought.
How to check which functions are disabled
Option 1: Create a phpinfo file
- Create a file called
phpinfo.phpin your website’s root directory - Add the following content:
<?php phpinfo(); ?>
- Visit
yourdomain.com/phpinfo.phpin your browser - Search the page for disable_functions
- The value will list all currently disabled functions
- Delete the phpinfo.php file after checking. It exposes sensitive server information that should not be publicly accessible.
Option 2: Check your error logs
In ULTRA Cloud, navigate to Debugging and Click Retrieve Logs to view recent PHP errors. On cPanel, check Errors in the main dashboard or review the error_log file in your site’s directory.
Can I enable disabled functions myself?
No. The disable_functions directive is set at the server level in the PHP configuration and cannot be changed via .htaccess, php.ini overrides, or within your PHP scripts. This requires a server administrator to modify.
Requesting a function to be enabled
If your application genuinely requires a disabled function, contact Freethought support and include:
- The domain name affected
- The exact function(s) you need enabled (e.g.
shell_exec,exec) - What the function is used for (e.g. “My backup plugin uses exec to run mysqldump”)
- The script or plugin that requires it
Our team will review the request. In most cases, functions can be enabled on a per-account basis if there is a legitimate use case. However, some functions may remain restricted depending on the server environment and hosting plan.
Commonly disabled functions
| Function | Purpose |
exec() | Executes a system command and returns the last line of output |
shell_exec() | Executes a command via the shell and returns the full output |
system() | Executes a command and displays the output directly |
passthru() | Executes a command and passes raw output to the browser |
popen() | Opens a pipe to a process for reading/writing |
proc_open() | Similar to popen but with more control over the process |
eval() | Evaluates a string as PHP code |
putenv() | Sets the value of an environment variable |
Workarounds and alternatives
- WordPress plugins: Many plugins offer alternatives that don’t require system functions. Check plugin documentation for “safe mode” or alternative methods.
- Built-in PHP functions: For file operations, use PHP’s native file functions (
copy(),rename(),unlink()) instead of calling system commands. - Scheduled tasks: If you need cron-like behaviour, use the built-in cron scheduler in ULTRA Cloud or Cron Jobs in cPanel rather than executing commands via PHP.
- Upgrade your plan: VPS and dedicated server plans typically have fewer restrictions, as you are not sharing resources with other customers.
Still need help?
If you’re unsure which function is causing the issue, or if you’d like us to review your use case, contact us at www.freethought.uk/contact/ and we’ll be happy to assist.