23 Dec
2016

laravel logo

Update Laravel 5.2 to 5.3 and update PHP 7.1 on Mac OS X

I had to recently update my version of Laravel 5.2 to Laravel 5.3 along with my php version to 7.1. It was a little bit tricky due to some missing help documentation, but I managed to figure it out. So if you are having the same problems then this should help.

WARNING: Don’t ignore this since it’s important! Now before doing anything I noticed a memory issue when installing and after searching around – it turned out to be the pragmarx -> tracker in the vendors folder. If you have installed this I would suggest you temporarily disable it while doing the update by changing the following file config/tracker.php and make this change ‘enabled’ => false.

 Step 1:

Install PHP 7.1

This first part isn’t really important since if you are running Laravel 5.2 then you should already be running the minimum version of PHP 5.6. But for me I decided to install PHP 7.1

So start by using terminal and enter the following.

It will also ask for your password before installing.

This could take a while but once done enter the next line to restart apache. And again it will ask for your password.

This restart should be instantaneous, so enter the following line to see which version of php is being used.

It should output the following…

 Step 2:

Files to change for installation to work

Now lets open the composer.json which is in the root folder and make the following changes.

to

and more importantly (without this change it wouldn’t update for me) since I had installed the Laravel Forms and HTML components

to

and

to

Next edit the following lines of code in the app/Providers/RouteServiceProvider.php file.

to

Next edit the following lines of code in the app/Providers/EventServiceProvider.php file.

to

So what’s the reason for editing to the 2 files in the Providers folder?

The answer being that if you were to run the update without doing this – the terminal will show the following error messages at the end of the installation.

 Step 4:

Update Laravel 5.2 to Laravel 5.3

Now we are going to do the update. So in the terminal use cd and enter the directory for this example something in MAMP folder.

Then input this to start the Laravel 5.3 update.

You should see the list of updates in the terminal.

laravel 5.2 to laravel 5.3 terminal

So now lets check it has worked and in the terminal input

It should now output

So in theory everything should work fine? Read on…

 Step 4:

/Applications/MAMP/htdocs/our-laravel-app/routes/web.php… (Fix)

After installing I tried the following code in the terminal to add the login author default controllers etc.

But I would keep getting the following errors, or similar.

Well it turns out there is a change in Laravel 5.3 with regard to the app/Http/routes.php file. It now uses a different folder and file structure. They are now in the same directory that contains the app folder for example routes/web.php

So the only workaround was to install a separate version of Laravel 5.3 using something like the following.

Now copy the following into your updated version of Laravel 5.3.

So now when inputting ‘php artisan make:auth‘ it will work fine.

I hope this has helped you with the update process from Laravel 5.2 to Laravel 5.3 and PHP 7.1.

avatar

Written by me@grafxflow

I am a freelance designer and developer of all things web - from CSS3 bootstrap responsive layouts through to WordPress and MVC CodeIgniter. I blog and tweet to hopefully share a little bit of knowledge that can help others around the web. Thanks for stopping by!

Follow grafxflow on twitter Follow grafxflow on github Follow grafxflow on google+
Posted in: <Laravel>

4 Thoughts on "Update Laravel 5.2 to 5.3 and update PHP 7.1 on Mac OS X"

  1. 23 Apr
    2017

    avatar

    Farghana Hussain

    I keep getting this error:
    laravel/framework v5.3.0 requires paragonie/random_compat ~1.4|~2.0 -> no matching package found.

    Can you help please?

  2. 23 Apr
    2017

    avatar

    me@grafxflow

    Unsure what could be causing it.

    Try:

    php composer.phar require paragonie/random_compat

    Or maybe try changing your php version if possible.

    Also do you have any more information – is this a standalone install or an update.

  3. 25 Apr
    2017

    avatar

    Farghana Hussain

    I was trying to upgrade 5.2 to 5.3. However, I have installed a fresh version of Laravel 5.3 and all seems fine. I think there was some cache issue and I had to manually delete the cache files.

    Anyways, thanks a lot for your response.

  4. 25 Apr
    2017

    avatar

    me@grafxflow

    Glad to hear you got it working.

    Just need to try 5.4 now 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *

smart search