Steve VanDevender
stevev@darkwing.uoregon.edu
PHP, a popular scripting language for dynamic web pages, is now available for use in CGI scripts on both Gladstone and Darkwing webservers.
PHP 4.0.6 has been installed to work like other CGI scripting languages, such as Perl. A slight drawback to this approach is that PHP scripts need to start with a line containing only #!/usr/local/bin/php and need to be made executable (via the UNIX shell command chmod +x). However, when installed in this way, PHP scripts work just like other CGI scripts and have the ability to create and update files.
Our Apache server configuration has been changed so that executable files whose names end in .cgi, .pl (Perl), and .php (PHP) will be automatically recognized and executed as CGI programs when placed in web page directories. (Previously, only ".cgi" was recognized.)
Note that the same risks apply to using PHP as they do to any other CGI scripting
language. If you're careless, others will be able to modify files in your account
or perform actions in your name. In addition, the standard Apache suEXEC security
checks will be applied to PHP scripts (see http://cc.uoregon.edu/cnews/summer2000/suexec.html
and http://darkwing.uoregon.edu/manual/suexec.html#model)
Below is an example of a simple PHP script :
#!/usr/local/bin/php
<html><head><title>PHP Info</title></head>
<body>
<?php phpinfo(); ?>
</body></html>
To run it, place this script in a file named info.php in your public_html directory. Use the command chmod +x ~/public_html/info.php to make the file executable. You'll then be able to access it from http://darkwing.uoregon.edu/~yourusername/info.php
Replace "yourusername" with your own username (if you do this on Gladstone, replace "darkwing" with "gladstone").
For more information about PHP, see http://www.php.net/ The Computing Center Document's Room (175 Grayson Hall) also has books on PHP that are available for checkout.