Installing PHP on Windows 10 Bash and Starting a Local Server

Similar documents
L.A.M.P. Stack Part I

Installing MediaWiki using VirtualBox

Web Server Setup Guide

ENCM 339 Fall 2017: Cygwin Setup Help

We want to install putty, an ssh client on the laptops. In the web browser goto:

Installing LAMP on Ubuntu and (Lucid Lynx, Maverick Meerkat)

School of Information and Computer Technology Sirindhorn International Institute of Technology Thammasat University

Using RDP with Azure Linux Virtual Machines

Installing OptiRain Open on Raspbian

Using Ruby and irb in CSE 341 Winter 2015

#Uncomment the second line to enable any form of FTP write command. #write_enable=yes

Installing VS Code. Instructions for the Window OS.

Installing MySQL on the Command Line

Setting Up a Development Server

Software Installation Manual

Contents. Note: pay attention to where you are. Note: Plaintext version. Note: pay attention to where you are... 1 Note: Plaintext version...

CS 143A. Principles of Operating Systems. Instructor : Prof. Anton Burtsev

Human-Computer Interaction Design

Masternode Setup Guide

Masternode Guide #1. Single masternode on Linux VPS (Ubuntu)+ control wallet on local PC (Windows)

GIT. A free and open source distributed version control system. User Guide. January, Department of Computer Science and Engineering

Getting started with Raspberry Pi (and WebIoPi framework)

Installing + Configuring

The Python Mini-Degree Development Environment Guide

Simulation Manager Configuration Guide

GUIDE Development tools for Windows(10) installation... 2

Your departmental website

Setup of PostgreSQL, pgadmin and importing data. CS3200 Database design (sp18 s2) Version 2/9/2018

Apache MySQL PHP PHPAdmin Install

Human-Computer Interaction Design

Topics. What is a RaspberryPi? Why should I want one? What is Raspbian? What is SSH? What is FTP? What is LAMP? Making a LAMP Stack!

Software Development I

OPENSTACK CLOUD RUNNING IN A VIRTUAL MACHINE. In Preferences, add 3 Host-only Ethernet Adapters with the following IP Addresses:

CAL 9-2: Café Soylent Green Chapter 12

OptiRain Open 2 Installation Guide for LInux. This guide provides general instructions for installing OptiRain Open 2 on a Linux based server.

INSTALLATION INSTRUCTIONS FOR IPYTHON ENVIRONMENT

Raspberry Pi Class Ed 299. Mike Davis Truman College 5/26/2015

Windows version involved: Windows 7, Windows Server 2008 R2.

SIS offline. Getting Started

VPS SETUP: What is a VPS? A VPS is a cloud server, running on a virtual machine. You can t run a masternode on your computer itself.

Bitnami MEAN for Huawei Enterprise Cloud

Setting up GitHub Version Control with Qt Creator*

Setting up VPS on Ovh public cloud and installing lamp server on Ubuntu instance

CMSC 201 Spring 2018 Lab 01 Hello World

Communication protocols and services

Getting Started With Windows 10

ULTEO OPEN VIRTUAL DESKTOP DEBIAN WHEEZY (7.0) SUPPORT

Course Wiki. Today s Topics. Web Resources. Amazon EC2. Linux. Apache PHP. Workflow and Tools. Extensible Networking Platform 1

Masternode Guide #1. Single masternode on Linux VPS (Ubuntu)+ Control wallet on local PC (Windows) (VPS installation with script :-) )

Git Setup Help using GitKraken (CSE 154)

CIS 231 Windows 10 Install Lab # 3

How To Start Mysql Use Linux Command Line Client In Xampp

Dreamweaver MX The Basics

EE516: Embedded Software Project 1. Setting Up Environment for Projects

Website Development Komodo Editor and HTML Intro

Creating and Publishing Your own website. MAC Version SEAS 001 Professor Ahmadi

Installing the CaptureSpace Lite Desktop Recorder application

Introduction to Cuda Visualization. Graphical Application Tunnelling on Palmetto

NAV Coin NavTech Server Installation and setup instructions

Classroom Manager/ Tec2Screen Manager. Installation instructions

Unlearning the Internet: Submitting Your Log

COP Spring 2011 Assignment 4 Working with Servers Due Monday, 28th February in class (17H15)

Introduction to Unix - Lab Exercise 0

SETTING UP 3 WORDPRESS SITES ON APACHE AND UBUNTU BY RAMI

How to Create a NetBeans PHP Project

Open Source Digitalization Application. Installation Manual

Tar Heel Chinese Crested Club Instructions for Changing THCCC Website Passwords

K-RATE INSTALLATION MANUAL

LPF Training Handbook!

Creating a multilingual site in WebPlus

Install New Java Client, Release GL 3.1 For Workstations Currently without Java

Using SourceTree on the Development Server

Student Website Setup

Installing Oxwall completely in Amazon Cloud

GoPrint Web Update Utility

umapps Using umapps 6/14/2017 Brought to you by: umtech & The Center for Teaching & Learning

Troubleshooting Guide for Migrating WordPress Installations

AP Computer Science Principles: Problem Set 1

1 Installation (briefly)

Software. Full Stack Web Development Intensive, Fall Lecture Topics. Class Sessions. Grading

CSCI 201 Lab 1 Environment Setup

Lesson 1 Raster Design. Successful Saving

Science One CS : Getting Started

Media Writer. Installation Guide LX-DOC-MW5.1.9-IN-EN-REVB. Version 5.1.9

Installing the WHI Virtual Private Network (VPN) for WHIX Users Updated 12/16/2016

Creating a Yubikey MFA Service in AWS

Apache Manual Install Ubuntu Php Mysql. Phpmyadmin No >>>CLICK HERE<<<

Masternode Setup Guide

CIS 231 Windows 7 Install Lab #2

Instructor s Notes Web Data Management Web Client/Server Concepts. Web Data Management Web Client/Server Concepts

G-WAN. Complete install process for Ubuntu (both for the 32 and the 64 OS versions).

UMHS Financial Systems Workspace & Smart View Templates

Chapter 4. Unix Tutorial. Unix Shell

CMSC 201 Spring 2017 Lab 01 Hello World

Your First Meteor Application

Web Design Competition File Upload Tutorial

Parallel Programming

Getting Started with PHP

Creating Web Pages with Mozilla s Composer and Uploading Files with CuteFTP

Using Vault. William E. Mihalo, PhD. Senior HPC Systems Engineer Academic and Research Technologies

Transcription:

Installing PHP on Windows 10 Bash and Starting a Local Server Bash on Ubuntu/Windows is a way to use a command line to run all kinds of programs (including git!). But we ll want a Bash terminal to run PHP and local servers (unless you use the MAMP alternative). If you don t have Ubuntu, you can find a very helpful guide on getting it installed here. If you have Windows 10 with Ubuntu, you are already almost ready to go with a local server and running a PHP service! Starting a Bash Terminal To open an Ubuntu Bash terminal, go to the Search panel in Windows and type Ubuntu. You should see the following result appear: TIp: Once you open Bash, you may find it helpful to pin at the bottom of your desktop for easy navigation later:

Installing PHP from Bash Next, we need to install PHP so we can run a local server. To install, first run sudo apt-get update sudo apt-get install php5-cli (If the previous command didn t work try: sudo apt-get install php libapache2-mod-php) Note: These commands will prompt you for your user password - you should provide this when prompted, but note that it won t display the characters you type. Moving your command line location to your CSE 154 code When you open a Bash terminal, you will need to change the current directory to point to one in your WIndows User directories. To do so, type the following: cd /mnt/c/users/yourusername/desktop/yourcse154folder

For example: Alright, now that we ve installed PHP and are in our desired working directory, we can start running our first PHP program as well as a local server (useful for fetching files or using web services we will write in PHP without needing to publish them to a public server). In this demo, I ve created a simple index.html file, index.css file, as well as a hello.php file in my cse154 directory. You can see the three different ways I can view the contents of cse154 which is in my Desktop: Starting a local server: It s important your Bash terminal is in the correct folder you are editing your CSE 154 files in! We can start a local server with PHP using the command php -S localhost:8000 which starts a server listening to the port 8000. This server will gives us the ability to run PHP web services and fetch from them in our JS files using relative links. Once you have a working website with HTML, CSS, JS, and PHP, you can publish to a public server like your student website. But it s tedious to use FIleZilla to update your files each time you make a change,

which is why a local server is very useful here. Without a server running, you won t be able to run a PHP service or fetch local files from your JS. Opening an index.html file from a local server location To open our index.html file, we open our browser and visit localhost:8000/index.html. localhost:8000 will point to the current location where you started the server in your Bash terminal. Since we started it in our cse154 directory with index.html and hello.php, adding index.html to the url will give us our index.html page, just like you ve already seen when viewing local HTML files in your browser. We can also run PHP services and view their output in our browser (we ll learn more Friday). Let s preview what that looks like! Let s take a closer look at the commands ran in the right terminal window. First, I ve ran the Bash command cat which outputs the contents of a file conveniently to my command line. You will see the entire contents of a simple PHP program hello.php printed out. Next, I ran that PHP program directly in the command line with php hello.php This basic PHP program prints out (echoes) hello!. When writing PHP programs, it s useful to be able to run them from the command line occasionally (you can t run a PHP program from Atom or Sublime). What you ll usually use though is the browser to run your PHP programs (usually as web services). As you see in the screenshot, after starting the local server and visiting the url localhost:8000/hello.php, we see the output of our PHP program in the browser! Conclusion

And that s it! You re ready to practice writing PHP programs now and run them from the command line or your browser with a local server running. Each time you close the terminal, your server will also finish, so make sure to restart it when you need. You will also need to move to your cse154 directory each time you open a terminal (come talk to Melissa if you want to learn how to automatically open a terminal in your desired directory) so make sure you have the cd /mnt/c/users/yourusername/desktop/yourcse154folder on hand somewhere.