Search code examples
windowslaravelautomationxamppstartupscript

How to autostart XAMPP and Laravel project in Windows


I need to setup my Laravel application and XAMPP locally in Windows so that it can be accessed from multiple PCs in my local network. I've set it up successfully, but now I want to autostart my Laravel application and XAMPP when Windows is started.


Solution

  • I've solved the problem. I am using XAMPP under Windows OS. These are the steps on how to autustart Laravel Project on localhost. First you have to Enable virtual host configuration like under those steps:

    1. Set virtual host in "C:\xampp\apache\conf\extra\httpd-vhosts.conf".
      The add a new virtual host (e.g: ship.com)

    # Virtual host of ship.com
    <VirtualHost *:80>
        DocumentRoot "C:\xampp\htdocs\ship-management-master\public"
        ServerAdmin ship.com
        <Directory "C:\xampp\htdocs\ship-management-master\public">
            Options Indexes FollowSymLinks
            AllowOverride All
            Require all granted
        </Directory>
    </VirtualHost>
    
    Now have to add your Laravel Project public folder path into "DocumentRoot" and "Directory".

    1. “C:\Windows\System32\drivers\etc\hosts” file, enter host entry.

      a) Go to Start Menu, Right-Click on Notepad++ page and choose Run as Administrator.
      b) Then got to
      “File->Open->C:\Windows\System32\drivers\etc\hosts”
      uncomment " 127.0.0.1 ship.com"
      and replace "localhost" name to your virtual host name aslike " 127.0.0.1 ship.com"
      c) If you couldn’t see the files, change File Type : All files and enter host entry in host file.

    2. Restart your Apache server and browse “ship.com”.