The “exec” PHP function has been disabled on your server. Contact your system administrator to enable it

*** Application Version -** OJS 3.3.0.2
*** Description of issue:** I installed a new Journal and can’t install ANY plugin, as server shows the error message above.
*** Steps you took leading up to the issue**: just going to plugins page and tried to install them
*** What you tried to resolve the issue**: I talked to the server admin. They said for security reasons are disabling some functions, like “exec”. They are asking us to move to a VPS managed by the user, so, that way we could adjust that, but it would be necessary Server Admins skills. We are paying a VPS, so we have access to the root, but some directives are being imposed by them.

They also recommend to change the application, to not force the usage of that function “exec”. Is there any workaround to install new plugins without using the “exec” function? For example, if I copy the plugin into the correct folder and force an update in the OJS, does the system will install the plugin correctly?

Thanks

Hi @sergiobm
You can install any plugin by using other methods which is by uploading the plugin file to the respective folder (generics, blocks, themes, or others) and activate it on the OJS as journal manager.

In any case, it is actually recommended to turn off this exec function because of security reasons. That’s why many hosts disabled it by default.

Hi all,

Just to note that manually installing a plugin via the file manager might not accomplish all the installation tasks that a plugin needs for proper installation, for example:

  • installing the plugin’s entry in the versions table (this can be accomplished using lib/pkp/tools/installPluginVersion.php)
  • creating any database tables the plugin might use
  • registering any scheduled tasks the plugin might work with

We have an open issue to decrease dependency on the exec function for cases where hosting providers have disabled it: Reduce dependency on `exec` · Issue #6077 · pkp/pkp-lib · GitHub

Regards,
Alec Smecher
Public Knowledge Project Team

1 Like

Dear all
Just recently on a cpanel server, we were able to set the ‘disable_functions = “”’ to a custom value by storing a custom ‘php.ini’ in OJS root folder. So this even works if OJS is installed in a subfolder - on cpanel.

All the best
Klaus

Hey @klausru, what you did was to create a single file called php.ini and put only this parameter “disable_functions” into the root of OJS to override the php.ini created by the admins? Is that work? can you please share your php.ini configuration just to take a look? Thanks!

Dear @sergiobm

the php.ini looks like this:

; cPanel-generated php ini directives, do not edit
; Manual editing of this file may result in unexpected behavior.
; To make changes to this file, use the cPanel MultiPHP INI Editor (Home >> Software >> MultiPHP INI Editor)
; For more information, read our documentation (https://go.cpanel.net/EA4ModifyINI)
; log PHP errors to a file 
log_errors = on
html_errors = on
log_errors_max_len = 0
error_reporting = 32767
error_log =  /path/to/logfile/ojs/errors_php.log
disable_functions = "opcache_get_status"
allow_url_fopen = On
allow_url_include = Off
display_errors = Off
enable_dl = On
file_uploads = On
max_execution_time = 300
max_input_time = 600
max_input_vars = 1000
memory_limit = 128M
post_max_size = 100M
session.gc_maxlifetime = 1440
session.save_path = "/var/cpanel/php/sessions/ea-php74"
upload_max_filesize = 100M
zlib.output_compression = Off

Interestingly, some of the directives like post_max_size do not work in our case. I guess that’s because overrides are disabled in the primary apache configuration, and we can’t change it. So the directive: disable_functions = "..." works in our case, but might not work on other cpanel servers. Just give it a try and countercheck with a custom phpinfo(); in the install folder of OJS.

All the best
Klaus

Tengo el mismo problema hice lo sugerido cree el php.ini en la raíz y le di solo la instrucción disable_functions = “” pero aun así me sigue apareciendo el error al tratar de actualizar un plugin
Captura33333

Mi php.ini
Captura4444