PHP: Configuration

PHP basic packages

Installed by default, but please check if it exists by typing php -m | grep -i <module_name>:

iconv, ftp, json, xml, simplexml, spl, mbstring, bcmath, zip, zlib, pcre, dom, session, date, hash, filter

Additional Required Packages

libapache2-mod-php8.1

Apache Webserver PHP Modul

php-common

Common files for PHP packages

php8.1

PHP base package

php8.1-bcmath

e.g. Faktura

php8.1-bz2

bzip2 module for PHP

php8.1-cli

e.g. Cronjobs, Series letters

php8.1-common

PHP Utilities

php8.1-curl

e.g. for Exchange Connector connection

php8.1-gd

e.g. Project management for chart generation

php8.1-igbinary

PHP serializer

php8.1-imap

e.g. E-Mail Manager, Mail Scanner

php8.1-intl

Internationalization functions (for translation of CRM+ and PDF templates Plus)

php8.1-ldap

e.g. Authentication via an MS Active Directory system

php8.1-mailparse

e.g. for Exchange Connector synchronization of SMIME attachments

php8.1-mbstring

Support of human speech and character encoding

php8.1-mysql

Database layer to connect CRM+ to the database.

php8.1-opcache

increases the PHP performance

php8.1-readline

Interface to the GNU readline library

php8.1-soap

e.g. Exchange Connector, customer portal

php8.1-ssh2

e.g. SFTP Backup

php8.1-tidy

For filtering dangerous HTML content

php8.1-xmlrpc

e.g. PBX connection

php8.1-xml

e.g. Datev

php8.1-zip

e.g. Datev

Optional Packages

php8.1-redis

Caching (also needs php-igbinary and redis-server)

Required PHP Functions

must not be listed in “disable_functions”

popen, escapeshellcmd, ini_restore, get_loaded_extensions, chmod, mkdir, rmdir, syslog, copy, unlink, rename, exec, shell_exec

PHP Apache / CLI Configuration

PHP Apache / Command Line Interface (CLI) Configuration

Create the file /etc/php/8.1/mods-available/custom-php.ini with following content, after creating the file enable the module by typing phpenmod custom-php.

; Custom configuration for php8.1 module
; priority=30

[Custom PHP Configuration]
; Enable / disable showing PHP is available on the server
expose_php = Off

; Maximum execution time of each script, in seconds
max_execution_time = 600

; Maximum amount of time each script may spend parsing request data
max_input_time = 300

; How many GET/POST/COOKIE input variables may be accepted
max_input_vars = 10000

; Maximum amount of memory a script may consume
memory_limit = 1024M

; Error reporting
error_reporting = E_ALL & ~(E_NOTICE | E_DEPRECATED | E_STRICT)

; Enable / disable displaying errors on screen
display_errors = Off

; Enable / disable logging errors
log_errors = On

; Output buffering
output_buffering = On

; Date time zone
date.timezone = 'Europe/Berlin'

; Allow access to session ID cookie only when protocol is HTTPS
session.cookie_secure = 1

; Allow access to session ID cookie only via HTTP/HTTPS
session.cookie_httponly = 1

; Maximum session life time in seconds (Garbage Collector)
session.gc_maxlifetime = 7200

; Internal/script encoding
mbstring.internal_encoding = UTF-8

; PHP's default character set is set to UTF-8.
default_charset = UTF-8

; PCRE library backtracking limit.
pcre.backtrack_limit = 5000000

; Enable / disable file uploads
file_uploads = On

; Maximum allowed size for uploaded files.
upload_max_filesize = 2M

; Maximum size of POST data that PHP will accept.
; Its value may be 0 to disable the limit. It is ignored if POST data reading
; is disabled through enable_post_data_reading.
post_max_size = 8M

; Max. Total size of files that can be uploaded.
max_file_uploads = 20

Note

For uploading files, set the following parameters according to your own needs.

Cache Configuration

Create the file /etc/php/8.1/mods-available/custom-opcache.ini with following content, after creating the file enable the module by typing phpenmod custom-opcache.

; configuration for php ZendOpcache module
; priority=05
zend_extension=opcache.so

; Enable / Disable OPcache for Apache
opcache.enable = 1

; Enable / Disable OPcache for CLI
opcache.enable_cli = 1

; The size of the shared memory storage used by OPcache, in megabytes (recommend 1024M)
opcache.memory_consumption = 512M

; The amount of memory used to store interned strings, in megabytes.
opcache.interned_strings_buffer = 16

; The maximum number of keys (and therefore scripts) in the OPcache hash table.
; ~5500x30 (find . -type f -print | grep php | wc -l) (max. 1.000.000)
opcache.max_accelerated_files = 10007

; The maximum percentage of wasted memory that is allowed before a restart is scheduled.
opcache.max_wasted_percentage = 5

; If enabled, OPcache will check for updated scripts every opcache.revalidate_freq seconds.
opcache.validate_timestamps = 0

Note

Please note that only one cacher may be installed / activated, otherwise complications and thus negative effects may occur.