Categories
Laravel Samuel

Upgrading Laravel from 5.1 -> 5.5 Part Two

In our second post of this upgrade series we are going to take our newly upgraded application from our local environment and push the new code up to the production server. For a detailed notes on actually upgrading your code base from 5.1 -> 5.5 go here: Upgrading Laravel from 5.1 -> 5.5

Steps We will Take:

– put site in maintenance mode: php artisan down

– run our deploy script
– delete vendor directory and run “composer install” with new code base

– upgrade version of php on the server to 7.1
– put site back up live: php artisan up

Troubleshooting Tips:

Undefined class constant ‘XLXS’
To Fix Run: composer update

Maatwebsite/excel 3.0.1 requires phpoffice/phpspreadsheet ^1.2
Phpoffice/phpspreadsheet 1.3.1 requires ext-iconv * -> the requested PHP extension iconv is missing

Fix for this is: yum install ea-php71-php-iconv

Maatwebsite/excel 3.0.1 requires phpoffice/phpspreadsheet ^1.2
Phpoffice/phpspreadsheet 1.3.1 requires ext-zip * -> the requested PHP extension zip is missing

Fix for this is: yum install ea-php71-php-zip

The only supported ciphers are AES-128-CBC and AES-256-CBC with the correct key lengths.
Fix for this: php artisan key:generate

Call to undefined method Illuminate\View\Factory::getFirstLoop()
Fix For this: php artisan view:clear

Categories
Samuel Voluntary Discomfort

6th Voluntary discomfort

Last months 0 clutter was a mixed bag. We definitely had the house much more organized and clutter free but with such a “vague” goal last month really did not feel like much of a challenge. Towards the end of the month we also had a few items laying around on the floor cluttering the space up so ultimately I’d give us a 60% grade on last months challenge…. but its a new month and time for a new challenge!

I will be sleeping with only 1 pillow for the month and Ellen will be giving up coffee for the entire month.

Categories
Samuel Voluntary Discomfort

5th Voluntary Discomfort

The low information diet we went on last month was a huge success. Ellen was able to abstain from all social media and I was able to completely break my habit of wasting too much time on news sites like CNN.

For this upcoming month we are going to live for 30 days “without any clutter”. This is admittedly somewhat vague, but for us this means keeping our house a lot more tidy than we typically do. The thought process here is that with less clutter it should be a more relaxing and soothing atmosphere to live it…. Hopefully that is the case!

Categories
Laravel

Using Laravel Shift For The First Time

This is a list of useful steps to follow when upgrading Laravel using shift:

General Helpful Notes:

– Our first priority is to get Laravel onto the new version, and then work out the errors from there. If a package or dependency is erroring out take note of the package, then delete it from composer.json. Once the new version of Laravel fully installs, then add the packages one at a time by typing:

composer require package-name

If you get an error when running the above telling you that a higher version of the package is needed, then type:

composer require ^version# package-name

– Alt + Enter in PHPStorm will add a missing class to your file automatically. Super useful!

– At time we might need to copy an entire file from the new version of Laravel into our project. When we do this a handy tip is that PHPstorm will highlight on the left hand side any sections where the file has changed. You can go to this individual line ant hit Control + Alt + Z and that single line will revert to the previous copy allowing you to see the differences.

Step By Step Notes:

1.) Create a new release branch from master, name the branch something like “upgrade”.

2.) Purchase the shift you want, and have it performed on the upgrade branch.

3.) Review all pull request comments for additional changes, install Larave (deleting dependencies/packages as needed and keeping them in a list to add back later). Run “composer update” (if the pre-scripts fail, add –no-scripts)

4.) Now we are ready to fire up our application and check for any errors. Starting in Laravel 5.2 artisan serve is deprecated and you need to instead use:
php -S localhost:8080 -t public/

Testing & Error Code Notes:

1.) If you see the error message:
Access level to Illuminate\Routing\Router::substituteImplicitBindings() must be public (as in class Illuminate\Contracts\Routing\Registrar) in C:\wamp64\www\vendor\laravel\framework\src\Illuminate\Routing\Router.php on line 21

The fix for this is to find where this is being called and set it to public. To find in PHPStorm open up find in path (Control + Shift + F). Select whole project and then search for substituteBindings. In our case this is pulling up in our router.php file. Sure enough substitute bindings was set to protected, we change it to public and our error is resolved.

2.) If you see the error message:
Uncaught ReflectionException: Class log does not exist in

The fix for this is to open up your .env file and make sure that all of your values are enclosed in quotes. So for example starting from the top your values should look like: APP_ENV="local"

3.) If you see the error:
Class 'Illuminate\Html\HtmlServiceProvider' not found

The fix for this is:

Add this to your composer.json file:
"require": {
"laravelcollective/html": "5.1.*"
}

Run composer update

Add the following to your providers array in config/app.php

'providers' => [
Collective\Html\HtmlServiceProvider::class,
],

Add the aliases to the aliases array of config/app.php
'aliases' => [
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
],

Run composer dump-autoload -o
Run composer update

**make sure to run composer update before adding the service provider or else you will get the error:
Class 'Collective\Html\HtmlServiceProvider::class' not found

4.) If you see the error:

FatalErrorException in Paginator.php line 15:
Declaration of Illuminate\Pagination\Paginator::render(?Illuminate\Contracts\Pagination\Presenter $presenter = NULL) must be compatible with Illuminate\Contracts\Pagination\Paginator::render($view = NULL)

The fix for this we need to delete the current vendor folder then run composer install