Era Host hosting
EraHost – Free Domain, Cheap Hosting!
Client Area
Support 24/7
Menu

Fix: proc_open() Has Been Disabled for Security Reasons

3 min read
06.05.2025

The error proc_open() has been disabled for security reasons occurs when the proc_open function is disabled in PHP for security reasons. Some hosting providers disable it to prevent command execution vulnerabilities.

proc_open Disabled for Security
proc_open disabled — host policy; re-enable carefully, or use alternative.

For closely related "PHP function disabled" topics, see Fix shell_exec() Has Been Disabled and assert_quiet_eval in PHP — Explanation & Troubleshooting.

What is the proc_open() Error

The proc_open() function is used to execute external processes from PHP scripts. It may be disabled by hosting providers in the following cases:

  • Shared hosting for enhanced security
  • Servers with strict security policies
  • Preventing arbitrary command execution
Important: If you're using shared hosting, you may need to contact technical support to enable this function.

Check if proc_open Is Disabled

Execute this command to see disabled PHP functions:

php -r "echo ini_get('disable_functions');"

Expected output (if proc_open is disabled):

exec,passthru,shell_exec,proc_open,system

If proc_open appears in the list, it means PHP is blocking this function.

Linux VDS
High performance for your projects
  • Root access and flexible setup
  • Control panel
  • NVMe disks
  • DDR5
Linux VDS

Enable proc_open() in php.ini

1. Find the php.ini File

Execute the command:

php --ini | grep "Loaded Configuration File"

Example output:

Loaded Configuration File: /etc/php/8.1/cli/php.ini

The path to your php.ini file may differ depending on the server configuration.

2. Edit php.ini

Open the file in a text editor:

sudo nano /etc/php/8.1/cli/php.ini

Find this line:

disable_functions = exec,passthru,shell_exec,proc_open,system

Remove proc_open and proc_close if they are listed:

disable_functions = exec,passthru,shell_exec,system

Save and exit (CTRL + X, then Y, then Enter).

3. Restart Apache or PHP-FPM

For Apache:

sudo systemctl restart apache2

For Nginx with PHP-FPM:

sudo systemctl restart php8.1-fpm

    sudo systemctl restart nginx

Now proc_open() should work!

Verify That proc_open() Is Enabled

Execute:

php -r "echo ini_get('disable_functions');"

Expected output (if proc_open is enabled):

exec,passthru,shell_exec,system

If proc_open is absent from the list, it's enabled!

Alternative: Enable proc_open() in .user.ini (Shared Hosting)

If you don't have root access, try adding this to the .user.ini file in the root folder of your site:

disable_functions =

This will override the default server settings (if your hosting provider allows it).

Note: The .user.ini file only works if the user_ini.filename directive is enabled in PHP.

Troubleshooting

Problem Solution
Still getting proc_open() error Make sure you edited the correct php.ini file (cli, apache2, or fpm). Check the configuration for your PHP version.
Shared hosting doesn't allow changes Contact your hosting provider and request enabling proc_open. Specify a specific reason, such as Composer operation.
Web server won't restart Use sudo systemctl restart php8.1-fpm apache2 to restart PHP and Apache simultaneously.
Changes not taking effect Check that you restarted the correct service. For PHP-FPM use sudo systemctl restart php8.1-fpm.

Summary

Task Command/Action
Check if proc_open() is disabled php -r "echo ini_get('disable_functions');"
Find php.ini file php --ini
Enable proc_open() in php.ini Remove proc_open from disable_functions
Restart server sudo systemctl restart apache2 or php-fpm
Verify fix Execute php -r "echo ini_get('disable_functions');"

Now proc_open() should be enabled and working correctly!

Frequently asked questions
Carefully. Re-enabling site-wide on shared hosting is rare — provider policy. cPanel "Select PHP Version" → Options usually lets you remove proc_open from disable_functions per-account. After that, your account has it; other accounts on the server keep the block. That's the right shared-hosting approach.
Depends on use case. For simple commands without I/O capture: exec() or shell_exec() (if also not disabled). For complex I/O: Symfony's Process component has fallbacks. For Composer: it specifically needs proc_open for parallel work — without it, Composer is very slow. For these high-value cases, hosting that allows proc_open is worth seeking.
Yes. Find loaded php.ini (`php -i | grep 'Loaded Configuration'`), edit the `disable_functions` line, remove `proc_open`. Restart PHP-FPM. Verify with `php -r 'var_dump(function_exists("proc_open"));'`. Per-vhost override possible via .user.ini in document root (but `disable_functions` not always respected in .user.ini — depends on PHP version).
It lets PHP spawn arbitrary processes with full I/O — a perfect primitive for webshell. Compromise a single file upload, attacker uses proc_open to spawn `bash`, has interactive shell. Hosts block by default; legitimate use re-enables with awareness. Don't disable on a VPS just to feel safer — hardening other paths (file upload validation, user input) matters more.
Related articles
Fix "Your PHP Version Does Not Meet the Bitrix Requirements" Error
Osclass Hosting — A Complete Guide for System Administrators
Understanding .cagefs in cPanel — What It Is and How to Fix Issues