Foreword
This article is only for recording the upgrade process
This article uses the Ubuntu16.04 system, if Windows only needs to change PHPStudy or download the relevant PHP version, I won’t say much, let’s take a look at the detailed introduction.
1、 Confirm and upgrade PHP version
Laravel 5.6 requires the PHP version to be ^7.13, while Laravel 5.4 only requires the ^5.6 version
I installed PHP 7.0 before, so I need to upgrade
Upgrade PHP
Terminal operation:
dpkg --get-selections | grep -v deinstall | grep php7.0
Check which components are installed in PHP
Then follow the steps below to run the upgrade one by one
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php7.1
sudo apt-get install php7.1-cli php7.1-common php7.1-json php7.1-opcache php7.1-mysql php7.1-mbstring php7.1-mcrypt php7.1-zip php7.1-fpm
sudo a2dismod php7.0
sudo a2enmod php7.1
sudo service apache2 restart
1.1 I want to remind everyone here
PHP7.2 has a question about Count
Write like this in PHP7.2
<? php
echo count(null);
The following error will be reported:
Warning: count(): Parameter must be an array or an object that implements Countable in
But below PHP7.1
Will return 0
So this time I pitted myself and finally dropped from PHP7.2 back to 7.1
The reason is that many third-party packages use Count but do not handle this error
2、 Modify Laravel's Composer.json
Change the version of PHP to 7.1.3 or above
Change phpunit to 6.0
Delete all php artisan optimize, because this command has been deleted after 5.6
Root terminal run: composer update
After waiting for a while, after updating
Type in the terminal: php artisan -V to view the Laravel version
3、 Log modification
5.4 It is different from the 5.6 log
So you need to add a logging.php configuration file under config, please copy the code inside
https://github.com/laravel/laravel/blob/develop/config/logging.php
Then add LOG_CHANNEL=stack under .env so that the log will not report errors
to sum up
The above is the entire content of this article. I hope that the content of this article has a certain reference value for your study or work. If you have any questions, you can leave a message and exchange. Thank you for your support to ZaLou.Cn.
Recommended Posts