Articles in this section

Domain's PHP function is not available: function() has been disabled for security reasons

Plesk for Linux kb: technical ABT: Group B

Applicable to:

  • Plesk for Linux

Symptoms

An error like this one appears in Domains > example.com > Logs, or on the website

Note: <function_name> is a placeholder and will be different in the actual error

Got error 'PHP message: PHP Fatal error: Uncaught Error: Call to undefined function <function_name>() in /var/www/vhosts/example.com/httpdocs/test.php:3\nStack trace:\n#0 {main}\n thrown in /var/www/vhosts/example.com/httpdocs/test.php on line 3'

Cause

The PHP function from the error is disabled in php.ini

Resolution

Warning: These steps don't work with PHP-FPM (global settings override them); they only apply to FastCGI.

Enable the disabled functions in the PHP configuration.

   
Individual Domain
   
  1. Log into Plesk

  2. Go to Domains > example.com > PHP Settings

  3. Remove the desired function from disable_functions

  4. Press OK

If there's no section called disable_functions, add disable_functions="" to Additional directives instead.

   

   
All Domains (Plesk Panel)
   
  1. Log into Plesk
  2. Identify the affected PHP handler in Domains > example.com > PHP

  3. Go to Tools & Settings > PHP Settings > Affected PHP version > php.ini

  4. Find disable_functions and remove the function from the error

  5. Press OK to save the changes

   
   
All Domains (CLI)
   
  1. Connect to the server via SSH

  2. Identify the affected PHP handler with this command

    Note: Replace example.com with the website from the error

    # plesk db "SELECT d.name,h.php_handler_id FROM domains d JOIN hosting h on h.dom_id=d.id WHERE name='example.com'"

  3. Edit the handler's php.ini

    Note: Replace X.X with the version from Step 2

    # vi /opt/plesk/php/X.X/etc/php.ini

  4. Find the line with disable_functions and delete the function from the error

  5. Restart the PHP service:

    # systemctl restart plesk-phpXX-fpm

   
Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.