I am installing magento 2.4.1 with php8 and it is giving me following error

Deprecated: Method ReflectionParameter::getClass() is deprecated in C:\xampp\htdocs\m2\vendor\magento\framework\Code\Reader\ClassReader.php on line 34

please help.



This error is because Magento 2 does not support PHP 8 yet. So you need to install xampp with the PHP version of 7.4.



1- add php 8 to your composer.json (keep v7.4)

"php": "^7.4|^8.0",

2- composer update


Kindly refer to the documentation guide for installing magento 2.4: https://devdocs.magento.com/guides/v2.4/install-gde/system-requirements.html#php


Till date, Magento has not released any stable/compatible release that can run on PHP 8.0 but if developer wants to give a try using following way to setup Magento in environment.

For this Magento has created separate branch based on Magento 2.4.1 on their github account.

You can setup project by following steps:

1. create folder named m2-php8
2. cd C:\xampp\htdocs\m2-php8
3. git clone --single-branch --branch php-develop https://github.com/magento/magento2/tree/php8-develop .
4. you can run setup commands as usual

NOTE: You can not use this code in production as this branch(php8-develop) is still under DEVELOPMENT.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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