Yesterday, I wrote about how to enable PostgreSQL drive in PHP 7.4. Today, I noticed Laravel 8 is already available. So, I have decided to migrate to Laravel 8 from Laravel 7. This short post shows how to configure some things in PHP 7.4 (PHP 7.x in general) for Laravel 8 for a local development environment.
Stuff I used
- Windows 10
- Laravel 7 and Laravel 8
- PHP 7.4
- I downloaded a zip distribution and extracted it to a directory
Modify php.ini For Composer
When I installed Laravel locally via the Composer, I got the following error, which is strange because I did not encounter this before.
C:\Users\karldev\Desktop\dev\prj\ws\ws2020>composer global require laravel/installer
Changed current directory to C:/Users/karldev/AppData/Roaming/Composer
The openssl extension is required for SSL/TLS protection but is not available. If you can not enable the openssl ex
tension, you can disable this error, at your own risk, by setting the 'disable-tls' option to true.
require [--dev] [--prefer-source] [--prefer-dist] [--fixed] [--no-progress] [--no-suggest] [--no-update] [--no-scripts] [--update-no-dev] [--update-with-dependencies] [--update-with-all-dependencies] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--] [<packages>]...
To fix this, I needed to modify php.ini for Laravel and uncomment the following line.
This may mean that Laravel 8 is now using openssl in some part of its codebase. On the other hand, it is also possible that openssl replaces something similar in Laravel 7. Bottom line, Laravel 8 now requires openssl.
Modify php.ini For Laravel 8
Once I resolved the problem and tried to create a new Laravel project, I got another error, as shown below.
C:\Users\karldev\Desktop\dev\prj\ws\ws2020>composer create-project --prefer-dist laravel/laravel blog
Creating a "laravel/laravel" project at "./blog"
Installing laravel/laravel (v8.0.0)
- Installing laravel/laravel (v8.0.0): Downloading (100%)
Created project in C:\Users\karldev\Desktop\dev\prj\ws\ws2020\blog
> @php -r "file_exists('.env') || copy('.env.example', '.env');"
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
- laravel/framework v8.0.1 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework v8.0.0 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/framework 8.x-dev requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- Installation request for laravel/framework ^8.0 -> satisfiable by laravel/framework[8.x-dev, v8.0.0, v8.0.1].
To enable extensions, verify that they are enabled in your .ini files:
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
To fix this, I uncommented the following line in the php.ini file.
After fixing those issues, I have not encountered other errors with Laravel 8 so far.