Table of contents
You can manage some server settings for your Pantheon Drupal site, including the PHP version, by editing the site's pantheon.yml configuration file.
This article shows how to change the PHP version. Other supported pantheon.yml settings use the same general process.
Before you begin
This procedure requires a local copy of your site's Git repository. If you have not previously downloaded your site's code, or need help setting up Git, follow the setup and Site code checkout instructions in Drupal on Pantheon (Build a site with Composer).
If you already have a local copy of the site's repository, open a terminal, change to the site's repository directory, and retrieve the latest changes:
git status
git pull
Finding pantheon.yml
Pantheon system settings for the site are stored in a file named pantheon.yml. The file is located in the root of the site's repository.
“Root” means the top level of the site's code directory, rather than a directory inside it.
Open the site's repository directory and locate:
pantheon.yml
Changing Settings
Once you find the pantheon.yml file, edit it with a text editor. For this article we will be editing the value of PHP, so search your pantheon.yml file for PHP. If your file has a PHP value you can edit it, if it does not you can add one. For this example we will change the PHP setting to use PHP version 8.3 by editing or adding the following value on its own line.
Enter the setting exactly as shown, including the underscore in php_version and the space after the colon.
pantheon.yml unless you intend to modify them.php_version: 8.3
Once you have added or edited the value, save the file.
Commit and push
Check which files have changed:
git status
You should see pantheon.yml listed as modified. If unrelated files are also listed, review those changes before continuing.
Add pantheon.yml to the commit:
git add pantheon.yml
Check the changes again:
git status
Commit the change with a brief description:
git commit -m "Update PHP version"
Push it to Pantheon:
git push
Test and deploy the change
After git push completes, Pantheon processes the change and makes it available in the Development environment.
Test the Development site before proceeding.
For a PHP-version change, verify that the Development site loads and that the site's important functionality continues to work as expected.
After confirming the change in Development, deploy it to Test, test the site again, and only then deploy it to Live.
See Drupal on Pantheon (Build a site with Composer) for the detailed Dev → Test → Live deployment procedure.
Other pantheon.yml settings
It is possible to adjust other values, such as the version of MariaDB database that your drupal site is using, by editing the pantheon.yml file as above. For example, to edit the version of Maria, you would find and edit or add the lines:
database:
version: 10.6
pantheon.yml supports additional Pantheon configuration values. Because available settings and supported versions can change, refer to Pantheon's documentation before modifying values not covered by this article.