Skip to main content

How to Change the PHP Version in cPanel

Hosting & cPanel · 25.01.2025 · 4 min read
Illustration for “How to Change the PHP Version in cPanel”

Changing the PHP Version

ZevsHost supports PHP 7.4, 8.0, 8.1, 8.2 and 8.3. You can change the version at any time without restarting the server — switching versions only affects how PHP scripts are processed, not the web server as a whole.

Via MultiPHP Manager

  1. Log in to cPanel
  2. Go to the "PHP" section → "MultiPHP Manager"
  3. Select a domain or directory
  4. Pick the PHP version you need from the dropdown
  5. Click "Apply"

The change applies instantly and only affects the selected domain — other sites on the same account keep running on their previous version.

Via .htaccess

If you need to set the version for a single subdirectory rather than the whole domain, add this line to .htaccess:

AddType application/x-httpd-php83 .php

This method does not work on every server configuration — if the host has mod_suphp disabled or uses a pure FPM handler without Apache handlers, this directive is ignored, and the version has to be changed through MultiPHP Manager instead.

Real Errors When Switching PHP Versions

After an upgrade, old code often stops working with an error like this:

Fatal error: Uncaught Error: Call to undefined function create_function()
in /home/user/public_html/wp-content/themes/old-theme/functions.php:112

This means the function was removed from the language in the new version (create_function was dropped in PHP 8.0) — the only fix is replacing the call with an anonymous function in the code; rolling back to an older PHP version will not save you from this problem accumulating later. Downgrading, on the other hand, often triggers a syntax error for newer language constructs:

Parse error: syntax error, unexpected '=>' (T_DOUBLE_ARROW), expecting ')'
in /home/user/public_html/index.php on line 8

That is what happens when a match expression or PHP 8.x named arguments run on a PHP 7.4 engine that does not understand them.

Comparing PHP Versions

PHP VersionStatusRecommended for
PHP 8.3CurrentNew projects
PHP 8.2LTSWordPress, Laravel
PHP 8.1Security onlyLegacy projects
PHP 7.4EOL since December 2022Not recommended

Configuring php.ini for the New Version

Every PHP version in MultiPHP INI Editor (cPanel → "PHP" → "MultiPHP INI Editor") has its own directive values — they are not carried over automatically when you switch versions. Recommended values for most CMS platforms:

DirectiveRecommended valueDescription
memory_limit256MMemory per script
max_execution_time60Maximum execution time in seconds
upload_max_filesize64MMaximum upload file size
post_max_size64MMaximum POST request size
max_input_vars3000Maximum form field count

The same values can be set through a .user.ini file in the site root if the host does not expose MultiPHP INI Editor for a specific subdirectory. Changes through .user.ini are not applied instantly but with a delay of up to five minutes, controlled by the user_ini.cache_ttl directive — worth remembering if an edit seems to "not work":

memory_limit = 256M
max_execution_time = 60
upload_max_filesize = 64M
post_max_size = 64M
max_input_vars = 3000

See the article on memory_limit and upload_max_filesize for a detailed breakdown of each directive.

When Not to Switch Right Away

  • The site uses plugins or themes that its author has not updated in a long time — check their support page for compatibility with the new version first
  • You have no staging copy of the site — switching versions on a live site without testing risks breaking it in front of visitors
  • Custom PHP extensions (.so files) are in use — they need to be recompiled for the new version, which a simple MultiPHP Manager switch cannot do
  • The code actively uses functions removed in PHP 8.x (create_function, each, get_magic_quotes_gpc) — they must be rewritten before the move

Recommendations

  • WordPress 6.x works best on PHP 8.2
  • Older sites with legacy code may require PHP 7.4, but that version has received no security patches since December 2022
  • After switching versions, check that the site still works: the homepage, the contact form, the admin panel

Verifying the Result

To confirm the version really changed, create a temporary file containing:

<?php phpinfo(); ?>

Open it in a browser, find the "PHP Version" line near the top of the page, and delete the file right after checking — phpinfo() exposes server details, including file paths and the list of installed extensions, that should not be visible to anyone else. For more on memory and upload limits for the new version, see the article on PHP Selector and MultiPHP INI Editor, and for diagnosing errors after a version switch, see the article on reading error_log in cPanel.

Was this article helpful?
← Back to Knowledge Base Ask Support