Moving from Ubuntu to Windows 11 as a software developer has been an interesting learning experience.
One thing I have discovered is that setting up a development environment on a new operating system sometimes requires more patience than writing the actual application code.
Recently, I encountered several challenges while configuring my PHP development environment on Windows 11 Pro.
I previously used Laravel Herd Lite, but I wanted to install PHP directly on Windows and have more control over my development environment.
My goal was simple:
- Remove the old PHP installation.
- Install PHP 8.4.1.
- Configure Windows PATH correctly.
- Install Composer.
- Verify that Composer uses the correct PHP version.
- Get my existing Laravel project, SamuPOS, running properly.
In this article, I will share the steps I followed, the errors I encountered, and the lessons I learned along the way.
If you are a beginner learning PHP or transitioning from Linux to Windows, I hope this experience helps you save some troubleshooting time.
1. Identifying the Existing PHP Installation
Before installing another PHP version, I needed to understand which PHP installation Windows was currently using.
I opened Command Prompt (CMD) and executed:
php -v The output was:
PHP 8.4.0 (cli) (built: Nov 21 2024 08:18:43) (NTS Visual C++ 2019 x64) I wanted to use PHP 8.4.1 instead.
However, simply downloading another PHP version would not solve the problem if Windows continued using the old executable.
I therefore executed:
where php The output revealed:
C:\Users\Backend-Nerd\.config\herd-lite\bin\php.exe This was an important discovery.
Windows was getting PHP from my previous Herd Lite installation.
Lesson learned
Whenever you encounter multiple software installations or version conflicts, identify the executable location before attempting to uninstall or reinstall anything.
The where command is particularly useful when troubleshooting executable paths on Windows.
2. Removing the Old PHP Installation
Since I no longer needed Herd Lite, I decided to remove its installation directory.
Instead of navigating through multiple folders manually, I used CMD.
rmdir /s /q "%USERPROFILE%\.config\herd-lite" Let's understand this command:
-
rmdir: Removes a directory. -
/s: Removes the directory and everything inside it. -
/q: Suppresses confirmation prompts. -
%USERPROFILE%: Represents the current Windows user directory.
Important: This removes the entire Herd Lite directory, not just PHP. Make sure you no longer need Herd Lite or its other services before executing this command.
After removing the folder, I could proceed with a fresh PHP installation.
3. Creating a PHP Installation Directory
I wanted to keep my PHP installation separate from other development tools.
I created a directory directly under the C drive:
mkdir C:\php My PHP installation would therefore be located at:
C:\php This made it easier to identify and manage the PHP executable.
4. Downloading PHP 8.4.1 Using Windows CMD
One interesting discovery was that I did not need to download PHP manually through a browser.
Windows CMD provides curl, which can download files directly from the internet.
I executed:
curl -L -o C:\php-8.4.1.zip https://windows.php.net/downloads/releases/archives/php-8.4.1-nts-Win32-vs17-x64.zip This downloaded the PHP 8.4.1 ZIP package.
I selected the following build:
- PHP version: 8.4.1
- Architecture: x64
- Build: Non Thread Safe (NTS)
- Compiler: VS17
For command-line PHP development, the NTS build is suitable.
Official download page:
https://windows.php.net/downloads/releases/archives/
Understanding the curl command
| Option | Meaning |
|---|---|
curl | Downloads files |
-L | Follows redirects |
-o | Specifies the output filename |
C:\php-8.4.1.zip | Destination of the downloaded file |
5. Extracting PHP Using CMD
After downloading PHP, I needed to extract its contents into the installation directory.
I used:
tar -xf C:\php-8.4.1.zip -C C:\php Explanation:
-
tar: Windows archive utility. -
-x: Extracts files. -
-f: Specifies the archive file. -
-C: Specifies the destination directory.
After extraction, the PHP executable was available at:
C:\php\php.exe I could now access PHP directly without using Herd Lite.
6. Creating the PHP Configuration File
PHP uses a configuration file called php.ini.
The downloaded package provides sample configuration files, including:
php.ini-developmentphp.ini-production
For my local development environment, I copied the development configuration.
copy C:\php\php.ini-development C:\php\php.ini This created the configuration file PHP would use.
The php.ini file controls PHP settings, extensions and other runtime configurations.
For Laravel development, several extensions are particularly useful.
Some examples include:
- OpenSSL
- cURL
- Mbstring
- PDO
- ZIP
- Fileinfo
- PostgreSQL PDO driver
I also verified that the extension directory was configured correctly:
extension_dir = "C:\php\ext" I enabled the required extensions in php.ini by removing the semicolon from their configuration lines.
For example:
extension=curl extension=fileinfo extension=mbstring extension=openssl extension=pdo_mysql extension=pdo_pgsql extension=pgsql extension=zip extension=intl Since my SamuPOS project uses PostgreSQL, enabling pdo_pgsql and pgsql was particularly important.
7. Adding PHP to Windows PATH
This was one of the most important steps.
Although PHP was installed, Windows could not necessarily recognize the php command from every directory.
I needed to add the PHP installation directory to the Windows PATH environment variable.
I used:
setx PATH "%PATH%;C:\php" This added the PHP directory to my user PATH.
The PATH environment variable allows Windows to locate executable files without requiring their full paths.
For example, instead of executing:
C:\php\php.exe -v I could simply execute:
php -v A useful warning: setx PATH "%PATH%;C:\php" can expand and copy the existing PATH and may cause problems with long PATH values. On an established development machine, editing the User PATH through Windows Environment Variables is safer. Avoid repeatedly running this command.
I also learned that existing terminal windows do not automatically receive newly updated environment variables.
Closing and reopening CMD or VS Code is important after modifying PATH.
8. Installing Microsoft Visual C++ Redistributable
PHP's Windows builds depend on Microsoft Visual C++ runtime libraries.
I downloaded the x64 redistributable from Microsoft:
https://aka.ms/vc14/vc_redist.x64.exe
I installed it to ensure the required runtime libraries were available.
This is useful when PHP reports missing DLL errors or fails to start.
9. Verifying PHP 8.4.1
After completing the installation, I opened a new CMD window and executed:
php -v I confirmed that PHP 8.4.1 was available.
I also checked the executable location:
where php The expected location was:
C:\php\php.exe To verify which configuration file PHP was loading, I executed:
php --ini This helped confirm that PHP was using:
C:\php\php.ini These checks are important because successfully extracting PHP does not automatically mean Windows is using the correct installation.
10. Installing Composer on Windows 11
With PHP working, the next step was installing Composer.
Composer is a dependency manager for PHP.
It helps developers install, update and manage the packages required by their PHP applications.
For example, Laravel relies on Composer to manage its framework and other dependencies.
I initially checked whether Composer was already installed:
composer -V Windows returned:
'composer' is not recognized as an internal or external command, operable program or batch file. I also executed:
where.exe composer The result was:
INFO: Could not find files for the given pattern(s). This confirmed that Composer was not accessible through Windows PATH.
Downloading Composer
I downloaded the official Windows installer:
https://getcomposer.org/Composer-Setup.exe
During installation, I selected my newly installed PHP executable:
C:\php\php.exe This was important because I wanted Composer to use PHP 8.4.1 instead of the old Herd Lite installation.
After completing the installation, I opened a new CMD window and executed:
composer -V My output was:
Composer version 2.11.3 2026-11-24 10:14:18 PHP version 8.4.1 (C:\php\php.exe) This confirmed that Composer was installed and using the correct PHP executable.
I also checked its location:
where.exe composer The output was:
C:\ProgramData\ComposerSetup\bin\composer C:\ProgramData\ComposerSetup\bin\composer.bat 11. Running Composer Diagnostics
Installing Composer does not necessarily mean everything is configured perfectly.
I wanted to verify that Composer could communicate with package repositories and that its dependencies were working correctly.
I navigated to my Laravel project:
cd /d "C:\Users\Backend-Nerd\OneDrive\Desktop\Development\samupos" Then I executed:
composer diagnose Most checks passed successfully.
Some of the important results included:
Checking Composer version: OK PHP version: 8.4.1 PHP binary path: C:\php\php.exe Checking http connectivity to packagist: OK Checking https connectivity to packagist: OK Checking git settings: OK However, I encountered two warnings worth understanding.
Warning 1: ZIP extension not loaded
Composer reported:
zip: extension not loaded, unzip not available, 7-Zip not available This meant PHP's ZIP extension was not enabled or available.
I opened the PHP configuration:
notepad C:\php\php.ini I checked the ZIP extension setting:
extension=zip I ensured it was enabled, saved the configuration and verified the loaded extensions using:
php -m The ZIP extension is useful because Composer can use ZIP archives when downloading packages.
Warning 2: GitHub API rate limit
Composer also reported:
GitHub has a rate limit on their API. You currently have 0 out of 60 requests left. This did not mean Composer was broken.
It meant unauthenticated GitHub API requests had exhausted their available hourly allowance.
For developers who frequently install dependencies from GitHub, configuring a GitHub personal access token in Composer can help increase the API allowance.
Documentation:
https://getcomposer.org/doc/articles/troubleshooting.md#api-rate-limiting-and-oauth-tokens
Understanding Composer's suggested packages
During my diagnostics and package inspection, I also encountered a long list of suggested dependencies.
Some examples included:
-
phpunit/phpunitfor automated testing. -
fakerphp/fakerfor generating test data. -
laravel/tinkerfor interactive Laravel development. -
guzzlehttp/guzzlefor HTTP requests. -
predis/predisfor Redis connectivity. -
league/flysystem-aws-s3-v3for Amazon S3 storage.
These suggestions are not necessarily installation errors.
They represent optional packages that provide additional functionality.
A beginner should not install every suggested dependency without understanding whether the application needs it.
12. Running Laravel Artisan Commands
With PHP and Composer configured, I returned to my SamuPOS Laravel project.
My project directory was:
C:\Users\Backend-Nerd\OneDrive\Desktop\Development\samupos I wanted to generate a controller for managing dining areas.
I executed:
php artisan make:controller DiningAreaController Laravel returned:
ERROR Controller already exists. Initially, this might look like another installation problem.
However, it was not.
Laravel had successfully executed the Artisan command and discovered that the controller already existed.
The controller was located at:
app/Http/Controllers/DiningAreaController.php This was actually confirmation that my PHP and Laravel command-line environment was working.
I did not need to reinstall PHP or Composer.
I simply needed to continue working with the existing controller.
13. Useful Commands for PHP and Laravel Developers on Windows
Here are some commands I found useful throughout this process.
| Command | Purpose |
|---|---|
php -v | Check PHP version |
where php | Find PHP executable |
php --ini | Find loaded PHP configuration |
php -m | List enabled extensions |
composer -V | Check Composer version |
where.exe composer | Find Composer executable |
composer diagnose | Diagnose Composer configuration |
composer show | List installed packages |
php artisan --version | Check Laravel version |
php artisan route:list | List application routes |
php artisan about | Inspect Laravel application information |
cls | Clear CMD screen |
One small difference for developers transitioning from Ubuntu:
Linux uses:
clear Windows CMD uses:
cls PowerShell also supports:
Clear-Host Understanding these small differences can save time when moving between operating systems.
14. Lessons I Learned from This Experience
This setup process taught me several important lessons.
1. Identify executable locations before uninstalling software.
The where command helped me discover that my old PHP version was coming from Herd Lite.
2. Understand how Windows PATH works.
Installing PHP is only one part of the process. Windows must also know where to find its executable.
3. You do not always need a development environment bundle.
PHP can be installed directly on Windows without relying on XAMPP or Herd.
4. Composer depends on PHP.
Selecting the correct php.exe during Composer installation ensures both tools work together.
5. Composer diagnostics are useful.
Running composer diagnose helped identify missing extensions and external API limitations.
6. Not every Laravel error is an installation problem.
The Controller already exists message was generated by Laravel because the requested controller was already present.
Learning to distinguish environment problems from application-level messages is an important developer skill.
Conclusion
What started as a PHP version replacement turned into a valuable learning experience about Windows development environments.
I learned how to remove an old PHP installation, install PHP 8.4.1 using CMD, configure environment variables, install Composer and verify that Laravel Artisan commands were working.
My next focus is continuing development on SamuPOS, particularly its Dining Areas and Restaurant Tables APIs.
For developers transitioning from Ubuntu or other Linux distributions to Windows, my biggest advice is this:
Do not rush to reinstall everything when something fails. First understand where the problem is coming from, inspect the output, and fix the actual cause.
Sometimes a single command such as where php can save you hours of troubleshooting.
