Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
VGSources
Blog

How to Install Laravel 13 on Ubuntu (PHP, Composer, Node.js and Production Setup)

A practical Laravel 13 Ubuntu installation guide covering PHP requirements, Composer, the official php.new bootstrap, Node.js and NPM, project creation, databases, troubleshooting and Nginx/PHP-FPM deployment.
Length10 min Posted Quest giverVGSources Team

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To install Laravel 13 on Ubuntu, install PHP 8.3 or newer with Laravel’s required extensions, Composer, the Laravel installer, and Node.js with NPM (or Bun). Laravel’s supported bootstrap command can install the PHP and Composer toolchain in one step; then you create an application, build its frontend assets, and start the local server with Artisan’s development runner.

What you need before installing Laravel

A Laravel application has two toolchains. PHP and Composer install and run the framework and its packages. Node.js with NPM (or Bun) installs and compiles browser assets through Vite. Laravel’s installation documentation lists PHP, Composer, and the Laravel installer as prerequisites, plus Node and NPM or Bun for frontend assets. See the official Laravel documentation for the current installation and deployment instructions.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

PHP version for Laravel 13

Laravel 13 requires PHP 8.3 or newer. It also requires the Ctype, cURL, DOM, Fileinfo, Filter, Hash, Mbstring, OpenSSL, PCRE, PDO, Session, Tokenizer, and XML extensions. Ubuntu package names depend on the Ubuntu release and the repositories enabled on that release, so install the matching php8.3-* packages from your release’s supported repositories rather than copying a package list intended for another Ubuntu version.

Check the PHP version after installation with:

php -v

The output should report PHP 8.3 or a later version. If Ubuntu selects an older system PHP, change the enabled repository or PHP alternative using the package-management procedure appropriate to your Ubuntu release before creating the Laravel project.

Composer

Composer resolves Laravel and your application’s PHP dependencies. Confirm it is available with:

composer --version

If the command is missing, the one-command Laravel bootstrap below installs PHP and Composer for Linux. If you already have a working PHP and Composer installation, you can install only Laravel’s command-line installer.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Node.js and NPM

Vite requires Node.js 16 or newer and NPM. A new Laravel application already contains the package metadata for the Laravel Vite plugin, but you still need to run npm install in the project directory before building assets.

node --version
npm --version

You may use Bun instead of Node and NPM if that is the runtime you have chosen. The commands in the standard Laravel workflow use NPM.

Choose an installation route

Situation Recommended route What it does
Fresh Ubuntu machine or no reliable PHP/Composer toolchain Use the php.new Linux bootstrap Installs the PHP and Composer tooling used by Laravel; you restart the terminal afterward.
PHP and Composer already work Install the Laravel installer with Composer Adds the laravel command globally without replacing your existing toolchain.
Local development Use composer run dev Starts Laravel’s development workflow; the application is available at http://localhost:8000.
Production Ubuntu server Nginx with PHP-FPM Serves the application’s public directory and passes PHP requests to PHP-FPM.

Do not treat the local development server as a production web server. It is useful for developing and testing an application on the Ubuntu machine; production needs a web server, PHP-FPM, permissions, deployment caching, and a process strategy for workers or other long-running services.

Install PHP, Composer and the Laravel installer with the official bootstrap

On Ubuntu/Linux, run the documented bootstrap command from a shell:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
/bin/bash -c "$(curl -fsSL https://php.new/install/linux/8.5)"

This command is the current Laravel-documented Linux bootstrap. It targets the PHP 8.5 toolchain, which satisfies Laravel 13’s PHP 8.3-or-newer requirement. Review the script and ensure curl is available on the machine before running it.

  1. Open a terminal on the Ubuntu machine.
  2. Run the bootstrap command exactly as shown.
  3. Allow the installer to finish.
  4. Close and restart the terminal session. Restarting ensures the shell sees any PATH or environment changes made by the installer.
  5. Verify the toolchain with php -v and composer --version.

If your organization requires packages from Ubuntu-managed repositories only, use the release-supported PHP and extension packages instead, then follow the existing-toolchain route below. The required PHP version and extensions remain the same; only the package installation method changes.

Install Laravel’s CLI installer when PHP and Composer already exist

When PHP and Composer are already correctly installed, install the Laravel installer globally:

composer global require laravel/installer

Open a new terminal session if Composer reports that its global vendor binary directory is not on the current shell PATH. Then check that the command is available:

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
laravel

The installer is a project-creation command. It does not replace the PHP runtime, install a database server, or compile frontend assets by itself.

Create a Laravel application on Ubuntu

From the directory where you keep development projects, run:

laravel new example-app

Replace example-app with the directory name you want. The command creates a new Laravel application and its initial configuration files. Move into the project before running NPM or Artisan commands:

cd example-app

Install and compile frontend assets

Install the JavaScript dependencies described by the new project:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
npm install

Build the frontend assets:

npm run build

Vite uses the Node.js and NPM toolchain for this step. If npm install fails, verify that Node.js is version 16 or newer, that NPM is on your PATH, and that you are running the command inside example-app, not its parent directory.

Start Laravel’s development workflow

Start the local development processes with:

composer run dev

When the command starts successfully, open http://localhost:8000 in a browser on the Ubuntu machine. If you are connecting from another computer, localhost refers to the computer running Laravel; use an explicitly configured, secured development-network address rather than assuming the local URL is publicly reachable.

Understand the generated .env file and database

Laravel creates an .env file for environment-specific settings. The file belongs to the individual machine or deployment environment, not to shared source control. Laravel’s documentation states: “Your .env file should not be committed to your application’s source control, since each developer / server using your application could require a different environment configuration.”

Add .env to the project’s ignored files if it is not already ignored, and keep secrets out of committed configuration. Share safe defaults through the project’s example environment file or your team’s secret-management process instead.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use the default SQLite database

A fresh Laravel application defaults to SQLite and creates database/database.sqlite. This is a convenient starting point for local development because it does not require a separate database server. Confirm that the file exists, then run the migrations from the project directory:

php artisan migrate

The migration command creates the tables defined by the application’s migration files in the configured database.

Switch to MySQL or PostgreSQL

If your application uses MySQL or PostgreSQL instead of SQLite, edit the database connection values in .env. Set the appropriate DB_* values for the database engine, host, port, database name, username, and password used by your Ubuntu environment. After the connection settings and database server are ready, run:

php artisan migrate

A migration failure usually means the connection values, credentials, database availability, or PHP database extension do not match the selected engine. Correct the environment settings first, then rerun the migration.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Verify an installation before writing application code

  • PHP: php -v reports 8.3 or newer for Laravel 13.
  • Composer: composer --version completes without a command-not-found error.
  • Laravel installer: laravel is available after the global Composer install.
  • Project directory: the shell is inside example-app before NPM and Artisan commands run.
  • Frontend dependencies: npm install completes before npm run build.
  • Environment: the project has its local .env and that file is not committed.
  • Database: SQLite’s database/database.sqlite exists, or the selected MySQL/PostgreSQL DB_* settings point to a reachable database.
  • Application: composer run dev starts and the site responds at http://localhost:8000.

Common Ubuntu installation problems and fixes

php is too old

Laravel 13 needs PHP 8.3 or newer. Check the active binary with php -v. Installing a newer package is not enough if Ubuntu still points the php command at an older alternative; select the supported PHP binary using your release’s normal alternatives and PATH procedures, then recheck the version.

A required PHP extension is missing

Laravel 13 requires Ctype, cURL, DOM, Fileinfo, Filter, Hash, Mbstring, OpenSSL, PCRE, PDO, Session, Tokenizer, and XML. Install the corresponding extension packages for the PHP version supplied by your Ubuntu repositories. Package names differ between releases, so match the package names to the enabled PHP version instead of using an unverified cross-release command.

laravel is not found after Composer installation

The Laravel installer is installed globally, but the shell may not include Composer’s global vendor binary directory in PATH. Start a new terminal session and check again. If it is still unavailable, inspect Composer’s global bin directory and add that directory to the shell profile used by your Ubuntu account.

npm or node is missing

Install Node.js and NPM from a source that supports your Ubuntu release, then verify both versions. Vite requires Node.js 16 or newer. Run npm install only after changing into the Laravel project directory.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The browser cannot load the local site

Keep composer run dev running in the terminal while testing. If the command exits, the development processes have stopped. Open the URL on the Ubuntu host itself when using localhost; a browser on another machine does not resolve its own localhost to the Ubuntu server.

Migrations fail after changing database engines

Review every DB_* value in .env, make sure the database exists and accepts the configured user, and confirm that PHP has the extension required by the selected driver. Run php artisan migrate again only after those settings are corrected.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Move a Laravel application from local Ubuntu to production

Production serving is a separate setup from creating a project. Laravel’s deployment guidance uses Nginx in front of PHP-FPM. Configure Nginx so the site’s document root is the Laravel application’s public directory, not the project root. PHP requests should be passed to the PHP-FPM socket for the PHP version installed on the server, and the server should block access to hidden files.

Set filesystem permissions

Laravel must be able to write to bootstrap/cache and storage. Grant write access to those directories for the web-server process owner while keeping the rest of the project as restrictive as your deployment model permits. A permission error in logs or during cache generation usually means the owner or group does not match the PHP-FPM/Nginx service account.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Optimize during deployment

After deploying code and installing its dependencies, Laravel provides:

php artisan optimize

This deployment command handles the framework’s configuration, event, route, and view cache preparation. Run it as part of a controlled deployment process, after environment values are present and before traffic is switched to the new release.

Reload long-running processes

Queue workers, Reverb, and Octane can keep old application code in memory. Laravel’s deployment documentation says these long-running services should be reloaded after new code is deployed. Include the reload or restart operation in the process manager you use, and verify that the new workers are running the new release.

Local development versus self-managed production

Decision Local Ubuntu development Self-managed Ubuntu production
Application entry point composer run dev and http://localhost:8000 Nginx points to the Laravel public directory.
PHP request handling Handled by the development workflow Nginx passes PHP requests to PHP-FPM.
Database starting point SQLite with database/database.sqlite SQLite, MySQL, or PostgreSQL according to the application’s DB_* configuration and operational needs.
File permissions Your development account can work in the project The web-server process owner must write to bootstrap/cache and storage.
Deployment maintenance Run commands interactively while developing Run php artisan optimize and reload long-running workers, Reverb, or Octane after releases.

If you do not want to maintain Nginx, PHP-FPM, permissions, and deployment processes yourself, Laravel’s deployment documentation also names Laravel Cloud and Laravel Forge as deployment options. Their availability and any partner or referral terms can change, so confirm current details before choosing one.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Frequently asked questions

Can I install Laravel without Node.js?

You can create and run the PHP application without immediately compiling browser assets, but Laravel’s documented setup expects Node and NPM or Bun when the application has frontend assets. Vite requires Node.js 16 or newer and NPM for the standard asset workflow, so install that toolchain before running npm install and npm run build.

Which PHP extensions must Ubuntu provide?

Laravel 13 lists Ctype, cURL, DOM, Fileinfo, Filter, Hash, Mbstring, OpenSSL, PCRE, PDO, Session, Tokenizer, and XML. Use the package names supplied by your Ubuntu release for PHP 8.3 or newer; names and repository availability vary by release.

Why is the Nginx root set to public?

The deployment layout exposes Laravel’s intended public entry point while keeping application code and environment files outside the web root. Configure Nginx to serve the project’s public directory and block hidden files as described in Laravel’s deployment guidance.

Where should production secrets go?

Use the server’s environment configuration in .env or an equivalent secret-management process, and do not commit that file. Each developer and server can require different environment values.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Do I need to run migrations immediately?

Run php artisan migrate when you want Laravel’s migration files applied to the configured database. A fresh project defaults to SQLite and creates database/database.sqlite; for MySQL or PostgreSQL, set the connection’s DB_* values first.

Frequently Asked Questions

What is the minimum PHP version for Laravel 13 on Ubuntu?

PHP 8.3 or newer, together with Laravel’s required extensions: Ctype, cURL, DOM, Fileinfo, Filter, Hash, Mbstring, OpenSSL, PCRE, PDO, Session, Tokenizer, and XML.

What command starts a newly installed Laravel application?

From the project directory, run composer run dev. The local application is then available at http://localhost:8000 while the development command remains running.

Should the Laravel .env file be committed to Git?

No. Laravel says the .env file should not be committed because each developer or server may require different environment configuration.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.