home—lects—hws
D2L—breeze (snow day)
running php on rucs
not via web
We will look at:
There is no youtube video for this content.
However
video from distance lecture (breeze),
2017-jan-24b (0h30m): syllabus-review; running php @ 0h21m
Reviewing a few linux commands
You are responsible for being familiar with the main options
for the following commands:
- ls -lF — list files in long format (show permissions/timestamp);
use -d to show directories themselves (rather than their contents).
- cd — change directory
- mkdir — make a directory
- chmod — change (permission) mode
- Optionally, any editor that can be run through a terminal window:
- nano — not a great editor, but most of its commands are listed
at the bottom of the screen, making it easy to learn;
- emacs — the kitchen sink of editors — great, but
it involves memorizing commands like
ctrl-S to search,
ctrl-X ctrl-S to save,
ctrl-C ctrl-C to compile and run the Java program you are editing,
and
ctrl-u tetris to play a game (seriously).
-
vim — an editor which can let you edit extremely quickly,
once you master the fact that it has “input mode” (where your keystrokes add
characters to your file, just like you'd expect), and “command mode” (where each
keystroke is an editing command — e.g. j moves down a line
and k moves up a line).
Tutorials for any of of these editors are easily searchable.
If you want to brush up (or, learn) basic unix,
this is a good
tutorial
(sections 1,2 on using the command-line for file basics,
and section 5 for file permissions).
Accessing rucs
Before we even revisit the code, let's talk about the machine
rucs.radford.edu
(“radford university computer science”):
it's a machine for use by ITEC department students,
and is a compute-server which you can access from anywhere.
How to log on to rucs, so that you can run php on it:
-
First, start the VPN, if you are off campus.
-
Then, either
-
-
Start a shell.
Windows: preferably bash,
but cmd may work too;
Mac: Terminal.app on Mac.
-
type ssh yourUserName@rucs.radford.edu
-
run putty (Windows-only).
Note that you can click the box “save” to have it remember your preferences —
in particular the machine-name and login-id.
Note that if rucs is down,
the alternate host ruacad.radford.edu can be used.
Be aware: rucs is not the
campus web server, nor the php server!
You don't have accounts on those machines
(although your H: drive is shared by those machines).
In particular: the version of php you run from
rucs's command-line is slightly different than the
version run by php.radford.edu !-o
Running PHP from the command line
Once logged on to rucs,
it is straightforward
to run a php program:
-
If you have a php file in your current directory, then
just enter php filename.php.
-
It's also often handy to just want to try a quick PHP code-fragment
to experiment:
type
php -a for a quick interactive session.
However, this raises the question of how to get your php program-files
onto your H: drive
in the first place.
How to edit files on rucs
Either
-
From your PC, mount your H: drive and then edit locally
(using Notepad or JEdit or eclipse... but not Word).
Each time you save your file, it's writing to your H: drive.
Or:
-
log in to rucs in a terminal-window,
and edit the file locally (vim, emacs, or pico).
I do not suggest editing the file locally, and then scp’ing them
over after each edit.
Note that if you have your own computer and have installed XAMP, it includes
a PHP interpreter (that's the ‘P’ in “XAMP”).
So you may find it easy to
However, you'll still need to know how to connect to rucs and run php there:
the reason is that the rather-quite-old version of PHP installed on rucs is
much closer to the old version of PHP used by php.radford.edu.
So when debugging, you'll want to be able to run PHP using
the exact H: files
and
the similar php version
as the web server uses.
home—lects—hws
D2L—breeze (snow day)
This page licensed CC-BY 4.0 Ian Barland Page last generated 2018.Jan.31 (Wed) | Please mail any suggestions (incl. typos, broken links) to ibarlandradford.edu |
|