Child pages
  • Command Line Setup
Skip to end of metadata
Go to start of metadata

Since version 4.9.1, CONTENIDO features an automated setup script. It is a PHP file which is supposed to be run with the CLI interpreter of PHP.

The CLI setup does not support upgrades yet!


In order for the script to work correctly, the working directory has to be the setup/ directory of your CONTENIDO installation.

$ cd contenido/setup/

The script itself has to be called with the php interpreter.

$ php ./autoinstall.php 

If the script suddenly stops without giving an error message try starting it like this:

php -d max_execution_time=0 ./autoinstall.php 

This tells PHP to let the script run indefinitely instead of interrupting it after a while.

With a standard installation this will start the interactive setup. The script will ask for necessary configuration options and you will have to enter them.

>>>>> Welcome to CONTENIDO <<<<<
Database settings:
	Host [localhost]:      
	User [root]: mysql
	Password: ***
	Database name [contenido]: 
	Charset [utf8]: 
	Prefix [con]: 
Please enter the http path to where the contenido/ folder resides
e.g. http://localhost/
	Backend web path []:

If you don't enter anything for one of the options, the setup will always use what is in written in the brackets as your answer. In this example, it would use "localhost" as the database host.

However, the script can also read this configuration from a .ini file. The default name for this is "autoinstall.ini". You can also use 

$ php ./autoinstall.php --file "/some/path/to/the/ini/file.ini"

to use "file.ini" instead of the default file.

An example configuration file can be found in "autoinstall-example.ini":

;Setup information for the automated CONTENIDO setup
;The autoinstall.php will always look for a file called 'autoinstall.ini' for configuration information
;You can also specify another file by calling "./autoinstall.php --ini PATH_TO_FILE"
;all of these settings are MANDATORY

;specify database connection settings in this section

;information about paths
;Use the path where the contenido folder is located in. (aka "PATH_TO_BACKEND/..")
;This is the path that web browsers will have to be able to use, so start with "http://..." and end with a "/"

;This setting specifies which components of the example client will be installed
;it can either be "CLIENTEXAMPLES" to install the complete example client,
;"CLIENTMODULES" to only install the modules
;or "NOCLIENT" to not install the example client at all

;set some information about the sysadmin account

Don't forget to delete your setup folder after installing! The .ini file you used for the setup contains sensible information like your sysadmin password and your database passwords!


The autoinstall script can also read settings from an XML instead of an ini file. There is also an example for that called "autoinstall-example.xml":

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE setup SYSTEM "installsettings.dtd">
<!-- For a more detailed documentation see the autoinstall-example.ini
The configurable settings are mostly the same -->

To use an XML file, just use the "–file" switch. The setup will detect automatically the right file type.

Interactive mode vs. non-interactive mode

Per default, the setup tries to be as interactive as possible and it will ask the users about potential errors or missing configuration values. If this behavior is not wanted (e.g. for some kind of automated setup), you can use

$ php ./autoinstall.php --non-interactive

This will disable all interactive features of the script. The configuration will be read from the .ini file (either the "autoinstall.ini" or whatever is given by the "–file" parameter). If some kind of error comes up, the script will terminate (for example if the ini file can't be found or read).

The script can also be forced to use the interactive mode, even though an "autoinstall.ini" is present. This is especially useful if only some of the values need to be changed, since the setup will use whatever is written in the ini file, if nothing is given by the user.

$ php ./autoinstall.php --interactive

If the autoinstall.php is started without one of those two parameters it will look for the .ini file and use it if it is present. If it is not present it will fall back to the interactive setup process.

Overwriting settings with command line parameters

The script also supports setting options with command line parameters. It uses the same names as the .ini file, so you can use parameters like

$ php ./autoinstall.php --db.database "someDatabaseName" --setup.client_mode "CLIENTMODULES"

and the setup will use "someDatabaseName" as database name and it will only install the modules of the example client.

Just be careful with passwords, since they will be saved in your bash history.

Advanced options

The setup is capable of deleting the database before installing it. This is especially useful for development purposes. To do that you have to add the right setting to your ini or XML file:


The setup will ask for confirmation before deleting anything, even if the "--non-interactive" parameter is present.

Other options

The command line setup is localized. You can choose the language by using the "–locale" parameter:

$ php ./autoinstall.php --locale de_DE

The locale has to be a valid CONTENIDO locale (meaning it has to exist as a subfolder of contenido/setup/locale).

For a quick overview about the possible parameters and what the script does, you can use 

$ php ./autoinstall.php --help

This will display a short summary of the valid parameters.

  • No labels