Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

rseletsk's avatar

Steps to move a Laravel application to another computer

Looking for basic steps to move a Laravel application to another computer (different Operating System)

0 likes
4 replies
LaryAI's avatar
Level 58

Certainly! Here’s a step-by-step solution to move a Laravel application to another computer, even if the operating systems are different:


Steps to Move a Laravel Application to Another Computer

  1. Copy the Project Files

    • Copy your entire Laravel project directory (excluding /vendor and /node_modules folders as they can be large and can be restored).
    • Optionally, you can use Git to pull from a repository if your project is version-controlled.
  2. Install PHP, Composer, and Other Requirements

    • Make sure the new computer has PHP (match your Laravel version requirements), Composer, and a web server (like Apache or Nginx) installed.
    • Install Node.js and npm if you use frontend assets built with Mix/Vite.
  3. Transfer the Project

    • Paste/move your project folder into the desired directory on the new machine.
  4. Install Composer Dependencies

    • In your new machine, open a terminal in the project root and run:
      composer install
      
  5. Install Node Dependencies (Optional)

    • If you use Laravel Mix or Vite for assets:
      npm install
      
    • Then build your assets as needed:
      npm run dev
      # or for production:
      npm run build
      
  6. Set Up Environment Configuration

    • Copy .env.example to .env:
      cp .env.example .env
      
    • Update .env with the new database, mail, and other relevant settings for the new environment.
  7. Generate Application Key

    php artisan key:generate
    
  8. Set Up the Database

    • Create a new database on the target machine.
    • If you have an existing database, export it (mysqldump, phpMyAdmin, etc.) from the old computer and import it to the new one.
  9. Run Migrations/Seeders (if needed)

    php artisan migrate --seed
    
    • Only if you want to migrate and seed the database from scratch.
  10. Set Correct Permissions (Linux/Mac)

    chmod -R 775 storage bootstrap/cache
    
  11. Start the Application

    • Start the local development server:
      php artisan serve
      
    • Or set up your web server (Apache/Nginx) to serve the project.

That’s it! Your Laravel app should now be running on the new computer.


Extra Tips:

  • Don’t forget to transfer any storage/app/public files if your app uses local file storage.
  • If you’re using git, pushing/pulling your code makes transfer much easier.
  • If you face permission issues, verify your web server user has access to the necessary directories.
1 like
Tray2's avatar

Easiest is to use github, other than that you can use a mounted share, or a regular usb stick.

1 like
rseletsk's avatar

Please briefly explain how you use github as opposed to 'build'?

DigitalArtisan's avatar

Just did this today, not for production, but from dev env on local host, to test env on intranet:

tar -cvzf YourProjectName.tgz YourProjectFolder/

COPY/SCP/ how every you want to move to a different OS.

tar -xvzf YourProjectName.tgz

Simple. Not what I normally do, but I am demonstrating proof of concept, waiting for more requirements and feedback, naming conventions etc. then I will push to a git repo, and push/pull from there to deploy.

I do this between Mac/Win/Linux.

Please or to participate in this conversation.