How To Install Apache, MySQL, & PHP on Windows Subsystem for Linux (WSL)

Поделиться
HTML-код
  • Опубликовано: 29 май 2024
  • View on website:
    scottsweb.dev/how-to-install-...
    In this video, part 2 of the series of setting up a development environment on Windows Subsytem for Linux (WSL), I show you how to install a LAMP server. This means installing Apache, MySQL, & PHP.
    It's easy to do and I'll put the commands here.
    Before getting started, update and upgrade the software you have on your Linux installation.
    Run:
    sudo apt update [press enter]
    sudo apt upgrade [press enter]
    How to Install Apache2 on WSL
    First, we will install Apache.
    Run:
    sudo apt install apache2
    Press y, then enter to agree to disk space usage
    Then, start apache and install it as a system service
    Run:
    sudo service apache2 start [press enter]
    sudo systemctl enable apache2 [press enter]
    How to install MySQL on WSL
    Run:
    sudo apt install mysql-server [press enter]
    press y, then enter to agree to disk space usage
    Secure MySQL installation on WSL
    Run:
    sudo mysql_secure_installation [press enter]
    Follow the prompts.
    Set MySQL Root Password on WSL
    Run:
    sudo mysql [press enter]
    Type:
    ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'yourpasswordhere'; [press enter]
    Replace 'yourpasswordhere' with your actual password.
    Type:
    FLUSH PRIVILEGES; [press enter]
    exit; [press enter]
    How to Install PHP on WSL
    Run:
    sudo apt install php libapache2-mod-php php-mysql [press enter]
    Restart webserver
    Run:
    sudo service apache2 [restart]
    Your web files will be located in /var/www/html
    The default apache index is in there. You can view your local webserver by going to localhost in your browser.
    Test PHP is working
    Create a index.php file in /var/www/html/. File contents will be opening php tag and then phpinfo();
    (replace [ with less than sign, youtube won't allow me to type the less than sign)
    [?php
    phpinfo();
    Save it and view localhost/index.php in your browser.
    In the next videos we will cover installing phpmyadmin, ssl (so we can use ) and setting up apache virtual hosts.
  • НаукаНаука

Комментарии •