skip to Main Content

I am using

  1. UBUNTU 20
  2. Vagrant 2.2.9
  3. Homestead release branch
  4. Composer version 1

After installing vagrant and homestead.
Whenever I hit any laravel project then I got this error.

Deprecated: Method ReflectionParameter::getClass()

I also update my PHP version using these below commands

 vagrant ssh

 sudo update-alternatives --config PHP


 sudo update-alternatives --set php /usr/bin/php7.1
 sudo update-alternatives --set phar /usr/bin/phar7.1
 sudo update-alternatives --set phar.phar /usr/bin/phar.phar7.1
 sudo update-alternatives --set phpize /usr/bin/phpize7.1
 sudo update-alternatives --set php-config /usr/bin/php-config7.1

After this when I check PHP version then it shows 7.1

I don’t know after changing the PHP version which service I need to restart?

2

Answers


  1. Deprecated: Method ReflectionParameter::getClass()

    it simply means that the method is no longer supported in PHP 8.

    Just open your Homestead.yaml file and add your PHP version in the sites section.

    -map: homestead.test
     to: /home/vagrant/code/public
     php: "7.1" #set the PHP version here
    

    And run

    vagrant reload --provision
    
    Login or Signup to reply.
  2. mmm put a phpinfo() in your index and tell me your results. I run in homestead the following command "php71" and the output of "php -v" is as expected

    PHP 7.1.33-37+ubuntu20.04.1+deb.sury.org+1 (cli) (built: May 1 2021
    11:51:55) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine
    v3.1.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.1.33-37+ubuntu20.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies

    However in my phpinfo() located in the index.php of the project the output is PHP Version 8.0.5 :S

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search