I have an 'older' site running Magento 2.4.2-p1 on the same server as my new site I'm working on which is running Magento 2.4.5-p1.

I have previously reached out to our hosting asking about PHP version and this is what they said in regards to our Magento 2.4.5-p1:

Be aware that the Global PHP on your server is 7.3. However, your website is using PHP 8.1. (we have a MultiPHP Manager in our WHM where you can select different PHP versions for different accounts).

They said they can change global to PHP 8.1 but to check whether that will run on our other account/website which is Magento 2.4.2-p1? Will switching Magento 2.4.2-p1 to PHP 8.1 work without problems?

1 Answer 1


No, according to magento 2's devdocs magento 2.4.2 7.4 php version is required.

for reference : System requirements for magento 2

however you can try alternatives to run magento 2 different versions by modifying htaccess files (try both htaccess file root or pub).

you may use this code:

<IfModule mod_rewrite.c>

   AddHandler application/x-httpd-php71 .php
   RewriteEngine On



or try this reference link: how to use multi php versions using htaccess?

  • Thank you for your suggestion. I looked at the link you provided and I can see it shows 7.4. The interesting bit is, I switched the PHP version via the MultiPHP Manager in our WHM to 8.1 for my Magento 2.4.2-p1 site and it appears to be running fine so far. I may ask hosting if we switch the 'global php' to 8.1 and things go wrong, if they be able to put it back to 7.4.
    – Allysin
    Commented Apr 27, 2023 at 11:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.