How to Install Laravel on WampServer
WampServer provides a local environment for Laravel, a productive PHP framework that needs a correctly prepared server to run well. WampServer gives you Apache, MySQL, and PHP on Windows in a single package, which makes it a practical base for Laravel development — as long as Composer, the PHP version, and the document root are configured properly. This guide walks you through the complete process, from checking prerequisites to opening your first Laravel welcome page in the browser.
Before you begin, make sure WampServer itself is installed and showing a green icon. If you have not done that yet, follow the guide to download and install WampServer on Windows first. Laravel also requires a recent PHP version, so check which version is active and, if needed, switch the PHP version in WampServer before creating your project. Getting these two basics right prevents most installation errors.
Laravel Installation Requirements on WampServer
Laravel is not installed by copying files in the way older PHP scripts were. It is created and managed through Composer, PHP's dependency manager. Composer downloads the framework, installs its packages, and generates the autoloader your application depends on. Your WampServer setup therefore needs four things in place: a running Apache and MySQL, a PHP version supported by the Laravel release you install, Composer available from the command line, and the PHP extensions Laravel expects, such as OpenSSL, PDO, Mbstring, Tokenizer, XML, Ctype, and JSON. Most of these extensions are enabled by default in WampServer 3.x, and you can confirm them from the WampServer menu under PHP > PHP Extensions.
Installing Composer for Laravel on Windows
Download the Composer Windows installer and run it. During setup, point it to php.exe inside the PHP version folder under bin/php/ in your WampServer directory. Finish the wizard, then reopen your terminal so Windows picks up the updated PATH.
Step 1: Verify the Composer Installation
Open Command Prompt or Windows Terminal and run composer --version. If a version line appears, Composer is ready. If Windows reports that the command is not recognized, reopen the terminal first. If it still fails, reinstall Composer and double-check the PHP path you selected, because Composer cannot run without a working PHP executable.
Creating a Laravel Project in the WampServer www Folder
Laravel projects live inside the www folder, but only the project's public folder should be exposed to the web.
Step 1: Open a Terminal in the www Folder
Navigate to the www directory, for example with cd C:\wamp64\www. Composer creates the project folder exactly where the terminal is pointing, so confirm the path first.
Step 2: Create the Laravel Project With Composer
Run composer create-project laravel/laravel myapp, using lowercase letters and no spaces for the name. Composer downloads the framework and dependencies, which can take several minutes. The new folder contains app, routes, resources, public, and a .env file.
Step 3: Generate the Application Key
Move into the project with cd myapp, then run php artisan key:generate. This writes a unique encryption key into .env. Never share it or delete it once the project holds real data.
Configuring the Laravel .env File for WampServer
The .env file holds environment-specific settings, including the database connection. Open it in a code editor and update the database lines to match the database you created in phpMyAdmin. For a typical local WampServer setup, the host is 127.0.0.1, the port is the default MySQL port, the username is root, and the password is empty unless you set one for the MySQL root account.
| Setting | Typical local value |
|---|---|
| DB_CONNECTION | mysql |
| DB_HOST | 127.0.0.1 |
| DB_DATABASE | your database name |
| DB_USERNAME | root |
| DB_PASSWORD | empty, unless you set one |
After saving .env, run php artisan config:clear from the project folder so Laravel does not keep using cached configuration. Then test the connection with php artisan migrate. If the default migrations run and create tables in your database, the connection is working. If you get an access denied error, recheck the username, password, and database name character by character.
Setting Up a Virtual Host for a Laravel Project
Serving Laravel through localhost/myapp often causes asset and routing problems. A virtual host solves this properly.
Step 1: Create the Virtual Host
Open the WampServer virtual hosts tool from the localhost homepage or use the menu to add a virtual host. Set the name to something like myapp.test and the path to the project's public folder, for example C:/wamp64/www/myapp/public. The key detail is the /public at the end — pointing the host at the project root instead is both a functional and a security mistake, because it can expose files that should stay private.
Step 2: Restart Services and Test
Restart Apache, or restart all WampServer services, so the new host is loaded. Then open http://myapp.test in your browser. You should see the Laravel welcome page. If the browser cannot find the address, check that WampServer added the entry to the Windows hosts file and that you restarted Apache after creating the host.
For a quick test, php artisan serve also works, but a virtual host matches production hosting better.
Running Migrations and Testing Your Laravel App
Run php artisan migrate, open a few pages, and test any forms. If anything fails, check storage/logs for clear error details, and make sure storage and bootstrap/cache are writable — permission problems there are a common cause of blank pages on Windows. Run composer update only inside the project folder and read its output carefully.
Laravel is an open-source PHP framework known for its expressive syntax and developer tooling, as described in the overview of Laravel on Wikipedia.
Frequently Asked Questions
Do I need to install Laravel inside WampServer itself?
No. Laravel is installed per project using Composer. WampServer provides Apache, MySQL, and PHP, while Composer creates each Laravel application inside the www folder. Each project keeps its own dependencies and .env configuration.
Why does my Laravel site show a blank page on WampServer?
The most common causes are a missing application key, an incorrect document root, or a database connection error. Run php artisan key:generate, confirm the virtual host points to the public folder, and check storage/logs for the exact error message.
Can I run multiple Laravel projects on one WampServer install?
Yes. Create each project in its own folder inside www, give each one its own database and virtual host, and keep a separate .env file for each. This is a normal and reliable way to develop several applications on one machine.
Should I use php artisan serve or a virtual host?
Use php artisan serve for quick tests and a virtual host for regular development. A virtual host with the public folder as document root matches production hosting more closely and avoids path and routing issues.
Conclusion
To install Laravel on WampServer successfully, prepare the base first: a green WampServer icon, the correct PHP version, and a working Composer installation. Create the project inside the www folder with Composer, generate the application key, connect the .env file to a MySQL database, and serve the site through a virtual host pointing at the public folder. Once the welcome page loads and migrations run cleanly, your local Laravel environment is ready for real development.