Configuration

While Lando recipes set sane defaults so they work out of the box, they are also configurable.

Here are the configuration options, set to the default values, for this recipe's Landofile. If you are unsure about where this goes or what this means we highly recommend scanning the recipes documentation to get a good handle on how the magicks work.

recipe: lamp
config:
  php: '7.4'
  composer_version: '2.2.12'
  webroot: .
  database: mysql:5.7
  xdebug: false
  config:
    server: SEE BELOW
    php: SEE BELOW
    database: SEE BELOW
    vhosts: SEE BELOW
1
2
3
4
5
6
7
8
9
10
11
12

Note that if the above config options are not enough, all Lando recipes can be further extended and overriden.

Choosing a php version

You can set php to any version that is available in our php service. However, you should make sure that whatever framework or custom code you write is designed to work with your choice.

The recipe config to set the LAMP recipe to use php version 5.3 is shown below:

recipe: lamp
config:
  php: '5.3'
1
2
3

Choosing a composer version

You can set composer_version to any version that is available in our php service.

recipe: lamp
config:
  composer_version: '1.10.1'
1
2
3

Choosing a database backend

By default, this recipe will use the default version of our mysqlopen in new window service as the database backend but you can also switch this to use mariadbopen in new window or 'postgres'open in new window instead. Note that you can also specify a version as long as it is a version available for use with lando for either mysql, mariadb or postgres.

If you are unsure about how to configure the database, we highly recommend you check out the mysqlopen in new window, mariadbopen in new windowand 'postgres'open in new window services before you change the default.

Using MySQL (default)

recipe: lamp
config:
  database: mysql
1
2
3

Using MariaDB

recipe: lamp
config:
  database: mariadb
1
2
3

Using Postgres

recipe: lamp
config:
  database: postgres
1
2
3

Using a custom version

recipe: lamp
config:
  database: postgres:9.6
1
2
3

Connecting to your database

Lando will automatically set up a database with a user and password and also set an environment variable called LANDO INFO that contains useful information about how your application can access other Lando services.

The default database connection information for a LAMP site is shown below:

Note that the host is not localhost but database.

database: lamp
username: lamp
password: lamp
host: database
# for mysql
port: 3306
# for postgres
# port: 5432
1
2
3
4
5
6
7
8

You can get also get the above information, and more, by using the lando info command.

Using custom config files

You may need to override our default LAMP configopen in new window with your own.

If you do this, you must use files that exist inside your application and express them relative to your project root as shown below:

Note that the default files may change based on how you set both ssl and via. Also note that the vhosts and server config will be explicitly for apache. We highly recommend you check out the apacheopen in new window if you plan to use a custom vhosts or server config.

A hypothetical project

Note that you can put your configuration files anywhere inside your application directory. We use a config directory in the below example but you can call it whatever you want such as .lando.

./
|-- config
   |-- default-ssl.conf
   |-- httpd.conf
   |-- my-custom.cnf
   |-- php.ini
|-- index.php
|-- .lando.yml
1
2
3
4
5
6
7
8

Landofile using custom lamp config

recipe: lamp
config:
  config:
    database: config/my-custom.cnf
    php: config/php.ini
    server: config/httpd.conf
    vhosts: config/default-ssl.conf
1
2
3
4
5
6
7