Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk11 min

How to Update config.php on a Self-Hosted ownCloud Server Safely

A practical guide to updating ownCloud’s config/config.php safely: back up the database and configuration, use occ for supported values, edit PHP carefully when necessary, and verify the result.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For a self-hosted ownCloud installation, the main server configuration is config/config.php. The safest way to change one supported system setting is usually occ config:system:set, executed as the account used by your web server. Edit the PHP file directly only when you need a manual change that the command does not handle. In either case, make restorable copies of the configuration and database first, inspect the resulting value, test the affected feature, and watch the logs before considering the change complete.

What config.php controls

ownCloud’s documentation describes config/config.php as the file that controls server operations. It contains system-level values such as the database connection, data directory, trusted hosts, URL-related settings, mail configuration, and other options that affect the whole installation. App-specific settings are stored separately, so changing a system value and changing an app preference are different tasks.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A mistake in this file can prevent PHP from parsing the configuration, cause permission errors, or make the service reject otherwise valid requests. Treat every production change as a small configuration deployment: identify the installation, create a rollback point, change one value, verify it, and test the behavior that prompted the change.

Find the correct ownCloud installation

The path shown in examples is relative to the ownCloud directory, not necessarily the directory from which you normally log in. First locate the directory that contains the occ command. Its sibling config/ directory should contain config.php.

#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter | 4Pack Type C Female to A Male Cable Converter for Apple Duo 17 16 15 14 Plus,iWatch Watch 12 11 10,iPad 9 8 Air,Airpods 5 4
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
  • Change to the ownCloud root before running relative commands.
  • Confirm that config/config.php belongs to the instance you intend to modify, especially when several virtual hosts or test installations share one server.
  • Identify the operating-system account used by the web server. The common account is www-data, but packaged installations and distributions can use another account.
  • Record whether the installation is a traditional web-root deployment, a container, or a distribution package. That choice determines the path, user, and command invocation.

Do not assume that every container uses /var/www/owncloud or that every image runs PHP as www-data. Use the deployment’s own documentation and inspect the running environment before changing anything.

Back up the configuration and database first

Back up both the ownCloud files needed for recovery and the server database before changing a production setting. The ownCloud manual’s maintenance guidance treats these backups as prerequisites. A copy of only config.php cannot restore database state if a maintenance operation or related change goes wrong.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. From the ownCloud root, copy config/config.php to a root-readable file whose name includes the date and time. Keep the copy outside the web root so it cannot be downloaded through the web server.
  2. Create a database backup with the database vendor’s supported backup utility. Keep the database dump with the configuration backup, but protect both as sensitive material.
  3. Store at least one copy on a different filesystem or host. An external drive used for server backups can provide a separate recovery copy, provided it is encrypted and access-controlled.
  4. Check that the backup files can actually be read by an administrator and that the database dump completed successfully before proceeding.

The configuration normally contains database credentials, mail credentials, and other secrets. Restrict ownership and permissions on the backup, do not place it under a public document root, and do not paste its contents into support tickets or chat channels.

Inspect current values without leaking secrets

Run the following from the ownCloud directory, replacing www-data with the account used by your web server:

sudo -u www-data ./occ config:list -- system

config:list -- system displays system configuration while omitting sensitive values by default. That makes it useful for checking the current state without printing credentials. Avoid adding --private unless the terminal output is being handled as secret material; command history, terminal recordings, CI logs, and pasted diagnostics can all retain the values.

Rank #2
Sale
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter | USB C Dongle with 90W Max Power Delivery, 3×5Gbps USB A Data Ports, for MacBook, Dell, and More (Charger Not Included)
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

Save the non-secret output when you need an audit trail, but review it before sharing. Confirm the key you plan to alter, its current type, and whether a deployment mechanism such as an environment variable may be supplying it.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Preferred method: change one value with occ

For an individual supported system parameter, use the documented occ command family:

sudo -u www-data ./occ config:system:set <parameter> --value='<value>'

Run it as the HTTP user, not as an arbitrary administrator account. ownCloud’s administration guidance specifically requires the HTTP user so file and directory ownership remain correct. Running the command as root can leave a newly written configuration owned by root, after which the web process may be unable to read or update it.

Quote values that contain spaces, punctuation, shell metacharacters, or leading symbols. Single quotes prevent most shell expansion, but they cannot safely contain a literal single quote without additional escaping. Never put a password or token directly in a command that will remain in shell history; use a safer secret-handling method appropriate to your operating system and deployment.

Use the correct type

The command accepts a type for values that are not strings. Use the type documented for the parameter:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter | 85W Max PD, 2 USB 3.0 & 1 USBC Data Ports, SD/TF Card Reader, for Laptops/Mac and Other Type C Devices (Charger Not Included)
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
  • --type=boolean for true/false switches.
  • --type=integer for whole numbers.
  • --type=double for decimal numbers.
  • --type=json for structured values represented as JSON.

Without the appropriate type, a value that looks like a number or Boolean can be stored as text and behave differently from what ownCloud expects. Preserve the parameter’s documented spelling and nesting; an almost-correct key creates a different setting rather than updating the intended one.

Example: changing a trusted-domain entry

Trusted domains determine which hostnames ownCloud will accept for web requests. Use the existing array index and set the hostname with the system command, adapting the index to the next available entry in your installation:

sudo -u www-data ./occ config:system:set trusted_domains 1 --value='cloud.example.net'

Do not remove an existing hostname that administrators still need. After the change, sign in through the exact hostname you added and test the intended HTTP and HTTPS paths. A hostname that resolves in a browser but is absent from the trusted-domain list can still be rejected by ownCloud.

When a direct edit is appropriate

Direct editing is useful when you need to review a multi-line block, add a setting not exposed by your installed occ version, or make a change during a controlled recovery. Open config/config.php with an editor that can write as root or as the account that owns the file, while preserving the file’s existing ownership and permissions.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Keep the opening PHP tag and the existing $CONFIG = array ( structure intact. Add or change only the entry you need; do not paste the entire config.sample.php. The official configuration reference says to enter only the parameters you wish to modify. Copying the sample wholesale can introduce obsolete defaults, overwrite deployment-specific values, or create duplicate keys that are difficult to diagnose.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray | Data transfer & Fast charging for MacBook, iPhone 17/16/15, iPad, Samsung Galaxy, Apple Watch
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
<?php
$CONFIG = array (
  'existing_setting' => 'existing value',
  'setting_to_change' => 'new value',
);

Match the surrounding PHP syntax exactly. String values require quotes, Boolean values use PHP Boolean syntax, arrays need brackets or the style already used in the file, and entries in a comma-separated array normally need a trailing comma. Do not add comments containing passwords or private host details if the file may later be shared for troubleshooting.

Validate syntax before reloading services

After saving a manual edit, run the PHP command-line interpreter’s syntax-check mode when it is available in your environment. A syntax check catches missing commas, quotes, brackets, and PHP tags before the web process encounters the file. It does not prove that a hostname, directory, database credential, or JSON value is operational, so continue with the functional checks described below.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

If the syntax check reports an error, restore the last known-good copy or fix the smallest possible line. Do not keep making unrelated edits while trying to diagnose one parse failure.

Use separate .config.php files for isolated custom blocks

ownCloud permits additional files ending in .config.php in the config/ directory. A narrowly named file can keep a logically separate custom block apart from the primary file, making review and rollback easier. This is particularly useful when a deployment team owns a small set of local overrides and wants to avoid editing a vendor-maintained or otherwise stable block.

Give the additional file the same ownership and permissions as the main configuration. Do not define the same key in several files unless you understand the load order and which value will win; duplicate definitions make an incident harder to investigate. Keep a record of why the separate file exists and which service or automation is responsible for it.

Best Value
Sale
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display | 85W Max PD, 1 Powered USB-C 5Gbps & 2 Powered USB-A 3.0 5Gbps Data Ports, for MacBook Pro, MacBook Air, Dell and More (Black)
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Docker and packaged installations

Container images commonly invoke occ through the container runtime, and some settings can be supplied through environment variables. In those deployments, the host’s copy of config/config.php may be a bind mount, a named volume, or not visible on the host at all.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Identify the running container or package instance that serves the affected ownCloud site.
  2. Enter that environment, or use the image or package’s documented command wrapper, instead of assuming the host path and user.
  3. Run the equivalent occ config:system:set command as the web-process user inside that environment.
  4. If the setting is officially supplied by an environment variable, change the deployment definition, secret, or compose configuration and recreate the container. Editing an ephemeral container layer can disappear on the next replacement.
  5. After recreation, repeat the inspection and functional tests to ensure the value came from the intended source.

Packaged installations can also place occ and the configuration directory in distribution-specific locations. Follow the package’s own documentation for paths, service users, and restart procedures rather than copying a command from an unrelated installation.

Verify the change and test the affected feature

Verification has two parts: confirm the stored value and confirm that ownCloud behaves correctly with it.

  1. Run sudo -u www-data ./occ config:list -- system again and compare the changed key with the value you intended to store.
  2. Exercise the feature affected by the change. For a trusted-domain update, sign in through the newly permitted hostname; for a path or mail change, perform the corresponding operation rather than relying only on a successful command.
  3. Review ownCloud, PHP, and web-server logs for parse errors, permission denials, rejected hosts, authentication failures, or other messages generated at the time of the test.
  4. Confirm that background jobs still run. A configuration change that fixes the browser request but prevents cron or queued jobs from starting is not complete.

Leave the backup available until the feature has passed its normal use case and any scheduled job has completed. Record the parameter, previous value when it is safe to record, new value, operator, date, and deployment method in your change log without copying secrets.

Recover if ownCloud stops working

If the service fails immediately after the change, first check the PHP and web-server logs for a syntax or permission error. A direct edit with a missing comma or quote usually fails before ownCloud can load; an occ change made under the wrong account can leave the file unreadable to the web process.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Stop making additional configuration changes while the cause is unknown.
  2. Restore the known-good configuration backup, preserving the file’s expected owner and permissions.
  3. Run the syntax check and occ config:list -- system as the web-server user.
  4. Retest the site and background jobs.
  5. Repeat the intended change with the smallest possible edit, using occ for a supported single value or a carefully reviewed manual edit when necessary.

If the configuration is correct but data and configuration are out of sync after a broader maintenance operation, use the database backup and the deployment’s documented recovery procedure. Do not restore a database dump over a live instance without first understanding the effect on newer user, file, and app data.

Direct editing versus occ

Method Syntax risk Auditability and repeatability Typed or JSON values Docker and automation Rollback
occ config:system:set Lower for supported keys because ownCloud writes the configuration format Command can be recorded and repeated, subject to safe secret handling Explicit support for Boolean, integer, double, and JSON types Works when invoked in the correct container or package environment Restore the configuration backup or apply the inverse command
Direct edit of config.php Higher; PHP array syntax and file structure must remain valid Diffs are easy to review when edits are kept small Any PHP value the installation supports, provided syntax is correct Works only against the persistent configuration used by the running deployment Replace the file with a known-good copy
Additional .config.php file Still syntax-sensitive, but the custom block is isolated Separate ownership and purpose can simplify review Supports the same configuration syntax as the main file Must be included in the persistent config volume or package path Remove or restore the isolated file

Choose occ for a single supported value and especially when type handling matters. Choose a direct edit when the required change is not practical through the command or when a reviewed block is easier to maintain as PHP. Use a separate configuration file when isolation improves ownership and rollback, but avoid duplicate keys.

Common mistakes to avoid

  • Editing the wrong instance: verify the directory containing both occ and the intended config/ directory.
  • Running occ as root: use the HTTP user so newly written files retain expected ownership.
  • Copying the sample configuration: add only the parameter you intend to modify.
  • Using the wrong value type: specify --type=boolean, --type=integer, --type=double, or --type=json when required.
  • Printing private values: leave out --private during routine inspection and protect command output.
  • Changing an ephemeral container: update the persistent deployment definition or environment variable and recreate the container.
  • Skipping the database backup: a configuration copy alone is not a complete production rollback plan.
  • Testing only the command: exercise the affected feature and inspect logs and background jobs.

A compact, repeatable change checklist

  • Locate the ownCloud root, occ, config/config.php, deployment type, and web-server account.
  • Back up the configuration and database; keep a copy outside the web root.
  • Inspect non-secret settings with occ config:list -- system.
  • Use occ config:system:set for one supported value, with the correct type and HTTP user.
  • If editing manually, preserve the PHP structure and change only the required entry.
  • For containers or packages, use the persistent path and documented invocation.
  • Inspect the resulting value, test the affected feature, review logs, and confirm background jobs.
  • If the service fails, restore the known-good configuration, correct ownership, and retry once the cause is understood.

Which approach should you use?

For most self-hosted administrators, the practical default is: back up first, inspect with config:list, change one supported system value with config:system:set as the HTTP user, and verify through the real feature. A direct edit remains valid, but it demands PHP syntax discipline and a syntax check. In Docker or a packaged installation, the deployment’s persistent configuration source takes precedence over assumptions about host paths. Keeping the edit narrow and the rollback obvious is more important than whether the final write was performed by a command or an editor.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.