Complete PHP 8.4 setup on Windows
Install PHP 8.4, configure php.ini, enable required extensions, and add PHP to PATH.
1. Download PHP
From the official PHP Windows downloads, download:
PHP 8.4 → VS17 x64 Thread Safe
Extract it to:
D:\php84You should have:
D:\php84\php.exe
D:\php84\ext\
D:\php84\php.ini-development
D:\php84\php.ini-production2. Install Visual C++ Redistributable
PHP's Windows builds require the Microsoft Visual C++ Redistributable.
Install the x64 Visual C++ Redistributable for Visual Studio 2015–2022 from Microsoft.
3. Create php.ini
Copy:
Copy-Item D:\php84\php.ini-development D:\php84\php.iniNow you have:
D:\php84\php.ini4. Configure PHP extensions
Open:
notepad D:\php84\php.iniFind:
;extension_dir = "./"Make sure you have:
extension_dir = "ext"Then enable the extensions Laravel/Composer commonly needs.
Find these:
;extension=curl
;extension=fileinfo
;extension=mbstring
;extension=openssl
;extension=pdo_mysql
;extension=mysqliChange them to:
extension=curl
extension=fileinfo
extension=mbstring
extension=openssl
extension=pdo_mysql
extension=mysqliAlso useful for Laravel:
extension=intl
extension=zipSo enable:
extension=intl
extension=zipYour important extensions are therefore:
extension=curl
extension=fileinfo
extension=mbstring
extension=openssl
extension=pdo_mysql
extension=mysqli
extension=intl
extension=zip5. Add PHP to Windows PATH
Open:
Start → Edit the system environment variables → Environment Variables
Find Path.
Add:
D:\php84If you already have other PHP versions:
D:\php83
C:\php85
D:\php84put:
D:\php84above the other PHP directories.
For example:
D:\php84
D:\php83
C:\php85
C:\Users\ADMK-Solutions\.config\herd-lite\binWindows uses the first matching php.exe it finds.
6. Restart your terminal
This is important.
Close PowerShell/CMD completely.
Open a new PowerShell.
Run:
where.exe phpYou want:
D:\php84\php.exeto be the first result.
Then:
php -vYou should see:
PHP 8.4.x7. Check which php.ini PHP is using
Run:
php --iniYou want:
Loaded Configuration File: D:\php84\php.iniIf it says (none), your php.ini isn't configured correctly.
8. Check PHP extensions
Run:
php -mOr check the important ones together:
php -m | Select-String "curl|fileinfo|mbstring|openssl|pdo_mysql|mysqli|intl|zip"You should see something similar to:
curl
fileinfo
intl
mbstring
mysqli
openssl
pdo_mysql
zipThis step is very important.
For example, your earlier Composer error:
requires ext-fileinfohappened because:
;extension=fileinfowas still commented out.
And your migration error:
could not find driverhappened because:
;extension=pdo_mysqlwasn't enabled.
9. Check Composer
If Composer is already installed:
composer --versionThen:
composer diagnoseComposer should now be using your PHP 8.4 installation.
You can check:
composer about10. Go to your Laravel project
cd D:\afzaal\restaurant-sassCheck PHP:
php -vThen install dependencies:
composer installDon't run composer update unless you specifically need to update dependencies.
composer install uses your existing composer.lock.
11. Create .env
If .env doesn't exist:
Copy-Item .env.example .envThen:
php artisan key:generateYou should get:
Application key set successfully.12. Configure MySQL
Since you're not using Docker, your MySQL must be running directly on Windows.
For example, if using XAMPP:
XAMPP
├── Apache
└── MySQL Start MySQL.
Then your .env might look like:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=restaurant_sass
DB_USERNAME=root
DB_PASSWORD=If your MySQL root user has a password:
DB_PASSWORD=your_password13. Create the database
You need a database called:
restaurant_sassYou can create it through:
phpMyAdmin
MySQL command line
MySQL Workbench
For example, SQL:
CREATE DATABASE restaurant_sass;14. Test MySQL connection
Check whether MySQL is listening on port 3306:
Test-NetConnection 127.0.0.1 -Port 3306You want:
TcpTestSucceeded : TrueIf you get:
Falseyour MySQL server isn't running or isn't using port 3306.
15. Clear Laravel configuration
After changing .env:
php artisan config:clearYou can also run:
php artisan cache:clear16. Run migrations
Now:
php artisan migrateIf everything is configured correctly:
INFO Preparing database.
INFO Running migrations.17. Install Node dependencies
Your Laravel React/Inertia application also needs Node.
Check:
node -v
npm -vThen from your project:
npm install18. Start the application
For development, you can use your project's Composer script:
composer run devOr run Laravel and Vite separately:
Terminal 1:
php artisan serveTerminal 2:
npm run devLaravel will normally be available at:
http://127.0.0.1:8000Your complete flow
When installing a new PHP version, remember this order:
1. Download PHP
↓
2. Extract PHP
↓
3. Install Visual C++ Redistributable
↓
4. Create php.ini
↓
5. Set extension_dir
↓
6. Enable PHP extensions
↓
7. Add PHP to Windows PATH
↓
8. Restart terminal
↓
9. php -v
↓
10. php --ini
↓
11. php -m
↓
12. composer --version
↓
13. cd Laravel-project
↓
14. composer install
↓
15. Copy .env.example → .env
↓
16. php artisan key:generate
↓
17. Start MySQL
↓
18. Configure .env
↓
19. php artisan config:clear
↓
20. php artisan migrate
↓
21. npm install
↓
22. composer run devFor your particular machine
You currently have multiple PHP installations, so your main thing to watch is:
where.exe phpThe first result determines which PHP your terminal uses.
For this Laravel project, make sure it is:
D:\php84\php.exeThen make sure:
php --inishows:
D:\php84\php.iniand:
php -m | Select-String "openssl|fileinfo|pdo_mysql"shows all three.
That three-part check will prevent the exact Composer and MySQL errors you just encountered.