How to enable/disable PHP native functions – php.ini Tutorial

Valerio Barbera

In this article I want to give you the step by step procedure to enable or disable php native functions editing the “disable_functions” directive in the php.ini file.

Sometimes the default PHP configuration on your server needs to be customized to accommodate the compatibility of your system with the production environment.

Why this tutorial

I’m the author of Inspector.dev the real-time monitoring package for Laravel and Symfony. This package uses “pro_open” and “proc_close” php native functions to perform data transfer from your server to the Inspector API asynchronously.

It can also be configured to use the native CURL functions of PHP that are enabled by default, but in this case it will send the monitoring data to Inspector in a synchronous way as other packages do like Sentry, Bugsnag, etc. That means that your application could slow down a bit because the php engine needs to wait before ending the connection with the client.

Recently some developers contacted me because proc_open and proc_close functions were disabled in their php configuration so they need to unlock them to take advantage of asynchronous data sending.

It’s quite rare but I decided to write this tutorial as a support resource for this use case.

What is the php.ini file

The php.ini file is THE configuration file for PHP. The file contains a list of key/value pairs called “directives”. Directives are grouped into sections, though these are mainly for organizational purposes.

When PHP starts up, it reads this file and sets up internal data structures to store the configuration. Throughout execution, PHP refers to these internal data structures to determine how it should behave in many key areas, like: Error handling and logging, Resource limits (memory, execution time), File uploads, Database connections, and more.

For someone who’s also wondering: PHP can work even if there is no php.ini file, it will simply apply the default values to all directives.

For who is not familiar with it, here is an example of a php.ini file:

https://github.com/php/php-src/blob/master/php.ini-production

For more technical articles you can follow me on Linkedin or X.

Enable/Disable functions in php.ini

Editing the php.ini file we can disable native PHP functions that you will not be able to call inside your PHP code.

Sometimes this feature is used to restrict the usage of some functions in shared hosting environments since a wrong usage of them can cause security issues to other users. Functions like exec() are usually disabled, but sometimes server providers are too conservative and can disable functions that are needed in everyday programming tasks.

Locate the php.ini file

Run the command below in your machine’s terminal to get the current location of the file (it works for both Win and Unix):

php --ini

Common locations: /etc/php.ini, /etc/php/7.x/php.ini (replace x with the version number of your installation)

To edit files on the server I prefer to use vim editor that should be available in any Unix machine.

// Use the file path from the command above
sudo vim /etc/php.ini

Scroll down to the “disable_functions” directive. It should be in the first half of the file and contains a list of functions separated by a comma.

disable_functions=exec,shell_exec,system,proc_open,popen,curl_exec,curl_multi_exec,parse_ini_file,show_source

Edit the php.ini file

  • Press the letter “i” on your keyboard to enter INSERT mode in vim.
  • Remove proc_open, and proc_close functions from the list.
  • When finished editing the file, press the ESC key. This takes you out of INSERT mode and “– INSERT –” disappears from the bottom left of your terminal.
  • To save the file, type in “:wq” , which is the write & quit instruction. 

Restart the PHP engine

To load the new configurations you need to restart PHP. The instruction below should work on most servers. You can eventually search on Google for a specific OS.

// Change the version of the PHP with what is in use in your machine
sudo systemctl restart php7.3-fpm.service

For more technical articles you can follow me on Linkedin or X.

Monitor your application for free

Inspector is a Code Execution Monitoring tool that allows you to trace your application behaviour in real-time.

With Inspector you don’t need to install anything on the server, just install the Laravel or Symfony package and you are ready to go.

If you want protect your users experience from disruptive events try Inspector for free. Register your account. It provides you with the appropriate code changes needed to fix application errors and bottlenecks.

Or learn more on the website: https://inspector.dev

Related Posts

Managing Human-in-the-Loop With Checkpoints – Neuron Workflow

The integration of human oversight into AI workflows has traditionally been a Python-dominated territory, leaving PHP developers to either compromise on their preferred stack or abandon sophisticated agentic patterns altogether. The new checkpointing feature in Neuron’s Workflow component continues to strengthen the dynamic of bringing production-ready human-in-the-loop capabilities directly to PHP environments. Checkpointing addresses a

Monitor Your PHP Applications Through Your AI Assistant – Inspector MCP server

You push code, hope it works, and discover issues when users complain or error rates spike. Traditional monitoring tools require constant context switching—jumping between your IDE, terminal, dashboard tabs, and documentation. This friction kills productivity and delays problem resolution. Inspector’s new MCP server changes this dynamic by connecting your AI coding assistant directly to your

High-Perfomance Tokenizer in PHP

When I launched Neuron AI Framework six months ago, I wasn’t certain PHP could compete with Python’s AI ecosystem. The framework’s growth to over 1,000 GitHub stars in five months changed that perspective entirely. What began as an experiment in bringing modern AI agents capabilities to PHP has evolved into something more substantial: proof that