home—lects—hws
D2L—breeze (snow day)
lect04-running-on-rucs
running php on rucs
where; file-protections; printing
Recall that when a web-server gets a request, it decides how to respond.
For php.radford.edu, some of the configuration rules:
-
It only accepts secure (https) connections.
-
For requests of the form ~userName/somePath/someFile.php,
it looks for the H-drive file ~userName/dynamic_php/somePath/someFile.php,
and it runs that .php program.
The program's printed output becomes the response.
-
The .php file must be readable by everybody (since it's being served up to the www),
and it must be non-writable by group,other (as a security measure: other users can't implant malware into your php program).
Apache runs php with the privileges of the file's owner (su).
Let's put our php program on the web!
-
Place the .php file inside dynamic_php/ on your H: drive.
You may have to create that directory if it doesn't already exist, using mkdir.
-
Make sure the file is world-readable, but not group-writable:
chmod g-w blend.php.
-
Make sure all the folders enclosing your file are other-executable but not group-writable:
chmod g-w . .., chmod o+x . ...
-
One crude way to get things to work:
Set every file to be rwxr-xr-x (whether or not it's a folder, .html file, or .php file):
Recursively change permissions:
chmod -r 755 ~/dynamic_php/
- Printing from php:
silly-page-php.txt
can be shortened to:
silly-page-v2-php.txt
-
If the php interpreter hits an error, the program terminates with no output (so nothing is sent back to the client)!
To change this default, include at the top of your php program:
error_reporting(E_ALL|E_STRICT);
|
home—lects—hws
D2L—breeze (snow day)