The error proc_open() has been disabled for security reasons occurs when the PHP function proc_open is disabled in the server configuration (php.ini). Many hosting providers disable this function for security reasons to prevent unauthorized command execution.
What is the proc_open() Error
The proc_open() function allows PHP scripts to launch external processes and interact with them through input/output pipes. It is commonly used:
- In build systems (Composer, npm)
- When working with version control systems
- For executing system commands from PHP
- In some frameworks and CMS
Check If proc_open() Is Disabled
Execute the following command to check disabled PHP functions:
Expected output (if proc_open is disabled):
If proc_open appears in the list, PHP is blocking this function.
Enable proc_open() in php.ini
1. Find the php.ini File
Execute the command:
Example output:
Your php.ini file may be located in different directories depending on the setup:
- For Apache: /etc/php/8.1/apache2/php.ini
- For Nginx with PHP-FPM: /etc/php/8.1/fpm/php.ini
- For CLI: /etc/php/8.1/cli/php.ini
2. Edit php.ini
Open the correct php.ini file using a text editor:
Find the line:
Remove proc_open and proc_close if they are present in the list:
Save and exit (CTRL + X, then Y, then Enter).
3. Restart Apache or PHP-FPM
For Apache:
For Nginx with PHP-FPM:
sudo systemctl restart nginx
Now proc_open() should be enabled!
4. Verify proc_open() is Enabled
Execute:
Expected output (if proc_open() is enabled):
If proc_open no longer appears in the list, the function is 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:
This will remove all disabled functions, but only works if your hosting provider allows overrides via .user.ini.
Troubleshooting
| Problem | Solution |
|---|---|
proc_open() still doesn't work |
Make sure you edited the correct php.ini file (cli vs apache2 vs fpm). Check all PHP configuration files on the server. |
| Shared hosting doesn't allow changes | Contact your hosting provider and request enabling proc_open. Specify that it's required for a specific application to work. |
| Web server won't restart | Use sudo systemctl restart php8.1-fpm apache2 to restart PHP and Apache simultaneously. Check error logs. |
| Changes not applying | Clear OPcache with sudo service php8.1-fpm reload or via the hosting control panel. |
Summary
| Task | Command/Action |
|---|---|
Check if proc_open() is disabled |
php -r "echo ini_get('disable_functions');" |
| Find php.ini file | php --ini | grep "Loaded Configuration File" |
Enable proc_open() in php.ini |
Remove proc_open from disable_functions |
| Restart server | sudo systemctl restart apache2 or sudo systemctl restart php-fpm |
| Verify fix | Execute php -r "echo ini_get('disable_functions');" |
Now proc_open() should be enabled and working!


