12

On my Local server everything was good was using mailtrap mail server as smtp server. but when my website is on live server and when I trying to reset password (forgot password ) getting following error screenshot is attached.I am using hostgators cpanels inbuilt smtp. any more details I will provide if needed.enter image description here

Rakesh K
  • 1,290
  • 1
  • 16
  • 43
  • 1
    You're running PHP 7.1 code on an older version – iainn Feb 14 '18 at 12:21
  • 1
    That questionmark is specifying a nullable type there. This is a functionality introduced in PHP 7.1. Most likely your server is running an older version of PHP. – Niels Feb 14 '18 at 12:22
  • @iainn and Niels Thank you for comment. changing php version solved my problem .. but now getting message that we have emailed you the reset link but I am not getting any mail ..I have checked all gmail folders including spam ... but No MAIL – Rakesh K Feb 14 '18 at 12:30

2 Answers2

33

You need to install PHP version 7.1 because nullable types were introduced in 7.1:

?string $value

And from the Laravel docs:

You will need to make sure your server meets the following requirements:

PHP >= 7.1.3

Community
  • 1
  • 1
Alexey Mezenin
  • 158,981
  • 26
  • 290
  • 279
  • 1
    changing php version solved my problem .. but now getting message that we have emailed you the reset link but I am not getting any mail ..I have checked all gmail folders including spam ... but No MAIL – Rakesh K Feb 14 '18 at 12:32
  • @kohali this is not related to the question. You should accept the answer and create a new one. Attach all related code and information regarding this new issue. – Alexey Mezenin Feb 14 '18 at 12:38
  • @AlexeyMezenin I'm having same issue with laravel 5.5 – TheManish Jun 16 '18 at 09:02
  • 1
    Lifesaver. Thank you so much. it works for me. after 5 hours of reserch – Aman Deep Dec 21 '21 at 14:39
6

For php7.0 only

If your server doesn't have php 7.1 and above and you are only restricted to use php7.0 do as below:

  1. Delete vendor folder
  2. Delete composer.lock file
  3. Add this to composer.json file under config

    "platform": {
       "php": "7.0.0"
    }
    

As well, ensure PHP version under require is set to 7.0.0 as shown below in config.platform.php:

    "config": {
        "platform": {
            "php": "7.0.0"
        }
     }
  1. Run composer install using CMD

This now will make sure that only dependencies compatible with php7.0 are installed.

mutiemule
  • 2,319
  • 2
  • 28
  • 34
  • Does not work. I have Php 7.2 on command line and I want Php 7.0 code base. – Ahmed Numaan May 08 '19 at 08:14
  • @AhmedNumaan what does not work exactly? Have you run `composer install` after making the changes? – mutiemule May 08 '19 at 12:43
  • Code is deployed on shared hosting where composer cannot be installed. So I ran composer command like you mentioned on my PC(Php version 7.2) and then I uploaded vendor directory to the server. It didn't work. – Ahmed Numaan May 10 '19 at 01:53
  • In your `composer.json`, the dependencies which have been installed, are they compatible with version 7.0 only? If you can verify that, then this could be another issue and not php version issue. – mutiemule May 20 '19 at 07:29