Easiest Laravel Installation with PHP 8.0 for Windows 10
Tags: php, beginners, laravel, tutorial
Published: 2021-09-11 20:39:56

## Quick Introduction
Almost every programming Crash Course I have ever viewed starts with basic setup and installation...except for most Laravel courses which assume you either have PHP, Composer, or Laravel already installed. With a JavaScript-based framework/library that is not usually a problem, but if you are new to the PHP space this can be a bit of a headache.   

I hope this post will take the struggle out some of the Laravel setup and __by the end of this tutorial you should be able to:
 - use PHP
 - run composer  
 - create a new Laravel project without any errors!



### Note:
-If you have already tried setting up Laravel and are having issues with PHP or Composer, I would recommend deleting your current installation files and their related PATH's and start over at [Step 1](#step-1).\ 
-If you are currently having problems with php.ini and fileinfo, like many of us starting with PHP 8, hopefully [Step 5](#step-5) will help.

___


## Step 1 - Download and Extract the PHP zip file<a name="step-1"></a>
1. Download PHP zip file from https://windows.php.net/download/
![php download](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rjrubmcabjv2rmem38fz.PNG)
2. Create a new folder in the C drive called "php8". This will make your PHP files easily accessible.
![easy php](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j8t4gwym9pa69whitmba.PNG)
3. Extract Downloaded PHP files to your new php8 folder
![extract php](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3me7lyli93izvfyubl5z.PNG)


___
## Step 2 - Download and Install Composer

1. Download __Composer-Setup.exe__ from [getcomposer.org/download](https://getcomposer.org/download/)
![download composer](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ezz6tyj4irmcxx80qssa.PNG)
2. Run the file and make sure that C:\php8\php.exe is your command line PHP and that a php.ini file is created. You can skip the Proxy Server Prompt.
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/90ligtjf7u8emyupwv9u.png)

___

## Step 3 - Check to see if PHP and Composer are working
1. Open your __Command Prompt__ and type ```php -v```. After you press _Enter_, you will see your PHP version number. 
2. In the __Command Prompt__ check for your composer in the same way with ```composer -v``` You will see the version number in addition to a list of commands composer can run.
![testing](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p2mi70n7t6brj3a1a0g8.PNG)

___

## Step 4 - Install Laravel Globally with Composer
In the __Command Prompt__ enter:
```
composer global require laravel/installer
```
and the Laravel will be installed on your system.
___
## Step 5 - Update the php.ini file <a name="step-5"></a>
### Problem
Laravel is now installed globally but when you try to create new file by typing:
```
laravel new example-app
```
the project will only be partially created and will throw the following error:
```
Problem 1
- laravel/framework[v8.12.0, ..., 8.x-dev] require league/flysystem ^1.1 -> satisfiable by league/flysystem[1.1.0, ..., 1.x-dev].
- league/flysystem[1.1.0, ..., 1.x-dev] require ext-fileinfo * -> it is missing from your system. Install or enable PHP's fileinfo extension.
- Root composer.json requires laravel/framework ^8.12 -> satisfiable by laravel/framework[v8.12.0, ..., 8.x-dev].
```
### Solution
The problem is that your php.ini file is missing the fileinfo and init extensions. The extensions are written into your php.ini file but need to be uncommented manually. Here is how to do it:

1. Open the php.ini file in your php8 folder. If you have not sorted your files is the file right below php.exe but right above php.ini-development. You can also search for it using the file explorer.  Then open the file in either Notepad or VScode. 
![php.ini](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ntahwsoztzgdv5bvx5sf.PNG)
2. Once the file is open, search for the text "fileinfo" with no spaces and you will come to a long list of extensions. Remove the ; from in front of ```;extension=fileinfo``` and ```;extension=intl``` 
![remove semicolons](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2navyz7410p4ave2hvyl.PNG)

3. Save the file and you are set! Time to create a new Laravel file and begin coding!
```
laravel new example-app
```