Preparing PHP

Before installing Nextcloud Server, ensure your PHP environment is properly configured. This includes installing the correct PHP version, enabling required PHP modules, and adjusting important php.ini settings. This guide explains which PHP modules are necessary, which are recommended for optimal performance and compatibility, and how to configure your PHP environment for both web server and command-line usage.

PHP Installation

Refer to your OS distribution's documentation for instructions for establishing a base PHP installation. It may be possible to choose among several versions of PHP. Refer to :doc:`./system_requirements` to see which versions of PHP are supported by this release of Nextcloud Server. After completing a base PHP installation, follow the below guidance to configure your new PHP installation for your new Nextcloud Server deployment.

Required PHP Modules

The following PHP modules must be installed and enabled for Nextcloud Server to function:

The ctype, fileinfo, and OpenSSL modules are generally included and enabled in PHP by default. Often some of the other required modules are automatically installed by OS distribution package managers.

How to check if a module is enabled:

Required PHP Database Connectors

Install the PHP connector module for the database you plan to use (choose one):

PHP Modules for Media Management

Image meta data and orientation (optional):

Preview Generation (optional):

See :doc:`../configuration_files/previews_configuration` for additional preview generation context.

PHP Modules for Specific Applications

Some optional Nextcloud apps/functionality require additional modules. Install as needed:

Recommended/Optional:

PHP ini Settings

Adjust the following settings in your php.ini as needed for Nextcloud:

Notes on PHP ini Configuration

PHP Module Quick Reference Table

Module

Required

Recommended

For Specific App

Description

ctype

✓

Core functionality

curl

✓

HTTP requests

DOM

✓

Document Object Model (XML/HTML handling)

fileinfo

✓

File type detection

filter*

✓*

Data filtering and validation (Mageia/FreeBSD)

GD

✓

Image processing

xml

✓

XML parsing (libxml2 >= 2.7.0) — provides the php 'xml' extension which exposes SimpleXML, XMLReader and XMLWriter

mbstring

✓

Multibyte character handling

OpenSSL

✓

Secure communications

posix

✓

POSIX functions

session

✓

Session support

zip

✓

Zip file handling

zlib

✓

Compression and decompression

intl

✓

Improves translations and sorting

sodium

✓

Argon2 password hashing

sysvsem

✓

System V semaphore support used to coordinate preview generation across PHP processes.

ldap

✓

LDAP integration

smbclient

✓

SMB/CIFS integration

ftp

✓

FTP storage/authentication

imap

✓

External user authentication

gmp

✓ (optional)

SFTP storage

exif

✓ (optional)

Image rotation in Pictures app

apcu

✓

Performance caching

memcached

✓

Performance caching

redis

✓

Transactional File Locking

imagick

✓ (optional)

Image previews

avconv/ffmpeg

✓ (optional)

Video previews

Open/LibreOffice

✓ (optional)

Document previews

pcntl

✓ (optional)

Command interruption in CLI

phar

✓ (optional)

Needed for command-line updater

*The filter module is required only on Mageia and FreeBSD.

Further Resources