Tag Archive for: apply directives for all installed php versions

Cloudlinux saving common php settings permanently for all installed versions

When you update cloudlinux,it also will be updated the php.ini files.Therefore you will lost your customized php settings like disable_functions.You can write some of yours into common settings file instead of editing php.ini’s directly.

Login to your cloudlinux and change directory to /etc/cl.selector/

You will see the file named global_php.ini.It is effective for your all installed alt-php* versions.Please open it by your favorite editor like nano or vi.

Sample global_php.ini with applied disable_functions directive

; This file provides global settings for php.ini of all alt-php packages
; The structure of this file:
; option = value
; To confirm changes (not affecting “date.timezone” and “error_log” options) please run:
; /usr/sbin/cagefsctl –setup-cl-selector
; To confirm changes (including “date.timezone” and “error_log” options) please run:
; /usr/bin/selectorctl –apply-global-php-ini
; or
; /usr/sbin/cagefsctl –apply-global-php-ini
; If you don’t want to change error_log, but want to change date.timezone, you can execute
; selectorctl –apply-global-php-ini date.timezone
; Similarly, command
; selectorctl –apply-global-php-ini error_log
; applies error_log and all other options specified in /etc/cl.selector/global_php.ini file, except date.timezone.
; So, you can specify 0, 1 or 2 parameters from the list: error_log, date.timezone
; using –apply-global-php-ini without arguments applies all global php options including two above
; Example:
; selectorctl –apply-global-php-ini error_log
; selectorctl –apply-global-php-ini date.timezone
; selectorctl –apply-global-php-ini date.timezone error_log
; The latter command has the same effect as /usr/bin/selectorctl –apply-global-php-ini
[Global PHP Settings] disable_functions= proc_open,escapeshellcmd,escapeshellarg, show_source,
posix_mkfifo, ini_restore, mysql_list_dbs, get_current_user, getmyuid,pconnect, link, symlink, fin, exec, fileread, shell_exec, pcntl_exec, leak, apache_child_terminate, ch
own, posix_kill, posix_setpgid, posix_setsid, posix_setuid, proc_terminate, syslog, fpassthru, execute, shell, chgrp, stream_select, passthru, socket_select, socket_create,
socket_create_listen, socket_create_pair, socket_listen, socket_accept, socket_bind, socket_strerror, pcntl_fork, pcntl_signal, pcntl_waitpid, pcntl_wexitstatus, pcntl_wif
exited, pcntl_wifsignaled, pcntl_wifstopped, pcntl_wstopsig, pcntl_wtermsig, openlog, apache_get_modules, apache_get_version, apache_getenv, apache_note, apache_setenv, vir
tual, eval, allow_url_fopen, pconnect, p_connect,posix_getpwuid,fileowner,sym

You should write your own directives down the global php settins tag in same syntax of standart php.ini [Global PHP Settings]

After then save and close the editor and apply it by this command

[root@srv ~]# selectorctl –apply-global-php-ini