Configuration

While Lando recipesopen in new window set sane defaults so they work out of the box, they are also configurableopen in new window.

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

recipe: lamp
config:
  php: '7.4'
  composer_version: '2.0.7'
  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 overridenopen in new window.

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 configopen in new window 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 mysql service as the database backend but you can also switch this to use mariadb or 'postgres' 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 mysql, mariadband 'postgres' 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 INFOopen in new window 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 infoopen in new window 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 apache 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