---
title: "Using Configuration Files"
url: https://docs.zeroc.com/ice/3.8/runtime/properties-and-configuration/using-configuration-files
docs_index: https://docs.zeroc.com/llms.txt
---

> For an index of every page, see [llms.txt](https://docs.zeroc.com/llms.txt).

# Using Configuration Files

This page is written for C++, C#, Java, MATLAB, PHP, Python, Ruby, and Swift.

Parts of this page are for some programming languages only, and name them. For one language's text alone, see [C++](https://docs.zeroc.com/ice/3.8/runtime/properties-and-configuration/using-configuration-files/cpp.md), [C#](https://docs.zeroc.com/ice/3.8/runtime/properties-and-configuration/using-configuration-files/csharp.md), [Java](https://docs.zeroc.com/ice/3.8/runtime/properties-and-configuration/using-configuration-files/java.md), [MATLAB](https://docs.zeroc.com/ice/3.8/runtime/properties-and-configuration/using-configuration-files/matlab.md), [PHP](https://docs.zeroc.com/ice/3.8/runtime/properties-and-configuration/using-configuration-files/php.md), [Python](https://docs.zeroc.com/ice/3.8/runtime/properties-and-configuration/using-configuration-files/python.md), [Ruby](https://docs.zeroc.com/ice/3.8/runtime/properties-and-configuration/using-configuration-files/ruby.md), and [Swift](https://docs.zeroc.com/ice/3.8/runtime/properties-and-configuration/using-configuration-files/swift.md).

A configuration file sets the properties of a communicator. Ice reads this file when you pass the command-line arguments of your program to communicator [initialization](https://docs.zeroc.com/ice/3.8/runtime/communicator.md#creating-a-communicator), or when you create a [property set](https://docs.zeroc.com/ice/3.8/runtime/properties-and-configuration/properties-class.md) from these arguments; the sections below describe how you select the file. You can also load a configuration file into an existing property set with its `load` method.

> **PHP**
>
> Ice for PHP can also read a configuration file named by the `ice.config` directive of `php.ini`, once, when PHP loads the extension. A script then obtains the resulting property set with `Ice\getProperties`; see [Property Sets](https://docs.zeroc.com/ice/3.8/runtime/communicator/php.md#property-sets).

## Selecting a Configuration File

The [Ice.Config](https://docs.zeroc.com/ice/3.8/property-reference/ice-properties.md#ice.config) property, set on the command line, names the configuration file:

```shell
./server --Ice.Config=/usr/local/filesystem/config
```

Without `Ice.Config`, Ice loads the file named by the `ICE_CONFIG` environment variable:

```shell
export ICE_CONFIG=/usr/local/filesystem/config
./server
```

When the command line sets `Ice.Config` more than once, the last one applies. A bare `--Ice.Config`, `--Ice.Config=1`, or `--Ice.Config=` tells Ice to use `ICE_CONFIG`. `Ice.Config` set in a configuration file loads no other file.

## Multiple Files and Precedence

Both `--Ice.Config` and `ICE_CONFIG` accept a list of file names separated by commas:

```shell
./server --Ice.Config=/usr/local/filesystem/config,./config
```

Ice loads the files from left to right: when both files set the same property, `./config` wins.

When the command line and a configuration file set the same property, the command line wins, wherever the `--Ice.Config` argument appears on the command line. For example, both of the following commands set `Ice.MessageSizeMax` to `4096`, whatever the configuration file sets:

```shell
./server --Ice.Config=/usr/local/filesystem/config --Ice.MessageSizeMax=4096
./server --Ice.MessageSizeMax=4096 --Ice.Config=/usr/local/filesystem/config
```

> **C++, Java, MATLAB, and Python**
>
> [Alternate Property Stores](https://docs.zeroc.com/ice/3.8/runtime/properties-and-configuration/alternate-property-stores.md) describes the other sources `Ice.Config` can name.

## See Also

- [Configuration File Syntax](https://docs.zeroc.com/ice/3.8/runtime/properties-and-configuration/configuration-file-syntax.md)
- [The Properties Class](https://docs.zeroc.com/ice/3.8/runtime/properties-and-configuration/properties-class.md)
