Drupal is an open-source content management system written in PHP. Unlike a hosted website builder, nobody updates the software underneath it for you unless your host or agency has agreed to. Your site depends on several layers, and each one has its own update schedule. This guide explains what those layers are, how to check the PHP version your site runs, where Drupal documents what it supports, and how to move to a newer PHP without taking the site down.
What actually runs underneath a Drupal site
A typical Drupal site is a stack of separate pieces:
- The operating system on the server, usually Linux.
- A web server such as Apache or Nginx.
- PHP, the language Drupal is written in and executed by.
- A database, commonly MySQL, MariaDB or PostgreSQL.
- Drupal core, plus contributed modules and themes.
- Composer packages that Drupal and its modules pull in as dependencies.
Drupal core, modules and themes are your responsibility whether you host the site yourself or pay a provider. Who looks after the lower layers depends on your hosting arrangement. On a managed Drupal host, the provider often handles the operating system and web server. On shared or unmanaged hosting, you or your developer usually handle more of it. Check your hosting plan and support documentation instead of assuming.
Why the PHP version matters
Each Drupal major version declares a minimum PHP version, and core and contributed code are tested against specific PHP releases. PHP itself has a published support lifecycle: each release gets a period of active fixes, then a period of security-only fixes, then nothing. Once a PHP release is out of support, security flaws found in it are not fixed, however current your Drupal code is.
That makes PHP a quiet risk. A site can have every module updated and still run on a PHP version that no longer receives fixes. The reverse also happens: upgrading PHP before your modules support it can cause fatal errors.
How to check which PHP version your site runs
Use whichever of these you have access to:
- Status report. Log in as an administrator and open Reports, then Status report (the path is /admin/reports/status). The PHP entry shows the version the web server uses. You can also follow its link to the full PHP information page, if your site allows it.
- Drush. Run drush status from the project folder. The output includes the PHP binary and version used by the command line.
- Hosting control panel. Many hosts show a PHP version selector for each site. Whether you get one depends on your host and plan.
- The server command line. Running php -v reports the command-line PHP, which can differ from the one the web server uses.
The command-line and web versions can differ on some servers. Treat the Status report as the answer for what visitors hit, and Drush as the answer for what your update commands use. If they disagree, fix that before anything else.
Where Drupal documents its supported PHP versions
Drupal.org maintains a PHP requirements page in its system requirements documentation. It lists which PHP versions each supported Drupal major version works with. Check it for your exact Drupal version instead of relying on a blog post or a forum answer, because the supported range shifts as new PHP releases arrive.
Your own project also records its constraints. In the composer.json file at the project root, the require section can list a PHP constraint, and a config.platform setting may pin the PHP version Composer assumes. Core and every module you install declare their own PHP requirements too, which is why Composer can tell you when a combination will not work.
To see which PHP releases the PHP project itself still supports, use the supported versions page on php.net. Compare the two lists: you want a PHP version that both Drupal supports and PHP still maintains.
Drupal 7 reached end of life on 5 January 2025, so a site still on it no longer receives security advisories from the Drupal Security Team. Moving the PHP version on such a site does not fix that, and the longer-term answer is a move to a supported major version. Drupal 10 and 11 are the supported majors.
How to upgrade PHP safely
Treat a PHP upgrade as a small project, not a switch you flip on the live site.
- Take a full backup of the code, the database and the uploaded files, and confirm you can restore it.
- Update Drupal core and modules first within your current major version. Newer releases often add support for newer PHP.
- Check compatibility with Composer. Running composer outdated shows which packages have updates, and composer why-not php followed by a target version shows which installed packages block it.
- Replace or patch blockers. Abandoned modules and old custom code are the usual culprits. Look for a maintained alternative or a fix from the module’s issue queue.
- Test on a staging copy that runs the target PHP version. Use a recent copy of the production database and files.
- Switch production through your host’s PHP selector or your server configuration, then clear caches with drush cache:rebuild.
- Watch the logs after the change. Check Reports, then Recent log messages, and your server’s PHP error log.
Keep the previous PHP version available for a quick rollback if your host allows it.
What to test on staging
- The homepage, a few content pages and every form, including submissions and email delivery.
- Login, user registration and password reset.
- Search, and any Views listings that drive important pages.
- Checkout, donation or other payment flows, if you have them.
- Cron runs and any scheduled jobs or imports.
- Admin screens for content editing, since editor tools often depend on many modules.
- The Status report, which should show no new warnings or errors.
Build a routine so it stays current
Subscribe to the Drupal Security Team’s advisories at drupal.org/security so you hear about core and contributed module fixes when they are published. Review the PHP support lifecycle on a regular schedule, and put the end-of-support date for your current PHP version on your calendar well ahead of time. Doing a PHP upgrade a little early is far easier than doing it under pressure after support has ended.
If a developer or agency maintains the site, ask them plainly which PHP version is running, when it stops receiving fixes, and who is responsible for the upgrade.
Frequently asked questions
Does Drupal run on PHP?
Yes. Drupal is written in PHP and needs a PHP runtime on the server, along with a web server and a database. Because you host it yourself, keeping PHP supported is part of keeping the site secure.
Is updating Drupal core enough to keep my site secure?
No. Core, contributed modules and themes all need updates, and so do the PHP version, web server and database underneath. Updating one layer does not protect you from a flaw in another.
Can I upgrade PHP without upgrading Drupal?
Sometimes, but only within the range your Drupal version supports. Check the PHP requirements page on drupal.org for your version, and test on staging first. If your Drupal version does not support the newer PHP, you need to upgrade Drupal as well.
Official references: Drupal PHP requirements, Drupal security advisories and PHP supported versions.