| ACADEMIC COMPUTING and COMMUNICATIONS CENTER | |||||||||
| |||||||||||||||||
6. PHP Examples | |||||||||||||||||
|
These examples do represent a range of issues involved in CGI programming using php and codewrap. I'm not very knowledgable with php, but I hope they are useful in getting started. They are in no sense complete, and make no effort to deal with issues of php that do not relate somehow to CGI. Caveat Emptor |
|||||||||||||||||
| Example 1 -- Trivial Case | |||||||||||||||||
|
|||||||||||||||||
| Example 2 -- Authentication | |||||||||||||||||
|
|||||||||||||||||
| Example 3 -- Debugging | |||||||||||||||||
codewrap-d
debugging to see some info about the codewrap environment. This example
shows what happens if you refer to a php script that doesn't exist.
(See Example 4 for a better debugging example.)
|
|||||||||||||||||
| Example 4 -- Reading/Writing Files and Debugging | |||||||||||||||||
PHP is configured to allow local i/o of files, ONLY if the
files are below the last This example tries to violate the restrictions. BTW, writing files from a CGI script is no different than from any other program. However, file locking is more important. It's quite possible for a CGI script to be invoked several times simultaneously, and for each of these invocations to write to the same file. However, if you are careful to lock and unlock the file properly, this is not a major problem.
|
|||||||||||||||||
| CGI | Previous: 5 Perl | Next: 7 Perl Examples |
| 2007-10-6 wwwtech@uic.edu |
|