It is possible to update the site configuration of your Pantheon Drupal environment to adjust server side settings such as the version of PHP your site is running on, as well as other settings such as the version of MariaDB.
In this article we will cover how to change the PHP version, but the procedure is the same for any value applicable to the pantheon.yml file.
Finding the Setting
Pantheon system settings are stored in a file named pantheon.yml, which will be stored in the root level of your sites code archive. Your sites code is stored in a Git repository hosted on Pantheon, it is best accessed via Git with either a command line or UI tool. For information on installing and setting up Git, we have the Drupal on Pantheon (Build a site with Composer) article. That KB article has a section on tools that breaks down how to install and setup Git.
Once you have Git installed, we will need to download the sites code repository. The code repository link is accessible from the Pantheon dashboard for your site, by clicking on the "Connection Info" button on the upper right of the dashboard, and then copying the line under "". This will copy the whole git command at once. With the Git clone line copied, create or change to a directory where you would like the code to downloaded to, and paste the line into your command line terminal. When the code finishes downloading, change into the code directory and look for a file named "pantheon.yml", it should exist in all sites, but if it is not in the root directory, you can make one.
Changing Settings
Once you find or create the pantheon.yml file, edit it with a text editor. For this article we will be editing the value of PHP, so search your file for "PHP", without the " marks. 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.1 by editing or adding the following value on its own line:
php_version: 8.1
Once you have added or edited the value, save the file.
Commit and push
After editing the pantheon.yml file, you are now ready to commit your changes to the site repo and push them back to the Pantheon server to be build. From your git repo on the command line, or from your git GUI, you should see that the pantheon.yml file has changed.
- Adding your changes with "
git add file_name
" or "git add .
"
- "git add ." adds all changes made at once
- Commit the changes with
git commit -m "your message here"
, and give the commit a message describing what changes were done between the "".
- the -m command is for leaving the commit message
- Once you have committed them, you can push your changes to Pantheon with
git push
.
Once you push your changes, Pantheon will run updates on their servers, and the changes will be deployed to the dev version of your site for review. Once you have tested the changes on the dev site, you will then need to push the code changes up to test and then again to the live site. Instructions for this are included in the Drupal on Pantheon (Build a site with Composer) article.
Other Values
It is possible to adjust other values, such as the version of MariaDB 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
For the full list of values or to view the Pantheon documentation, please review the resources below.
Resources
https://pantheon.io/docs/pantheon-yml
https://pantheon.io/docs/pantheon-yml#php-version
https://github.com/pantheon-systems/quicksilver-examples/blob/main/example.pantheon.yml