Indiana University Northwest
 
skip navigation bar
Indiana 
University Northwest
ribbon
skip navigation bar

Web Services

  

Advanced Search | Find People 
red line

PHP Programming

Summary of 4 things to do for PHP at IU

Below is excerpts from the list serve e-mailing from Michael Hunsaker to the group and wonderful information from Ted Frick, Associate Professor and Web Director, School of Education, Indiana University.

- This page is available thanks to permission from Ted Frick and Mike Hunsaker. -

Original Question (excerpt) from Hunsaker, Michael S

>
> After requesting a Veritas account, I noticed that PHP4 and MySQL were supported. I already had a web site created on my local machine in PHP and MySQL but wanted to transfer the site over to the IU servers. The conversion was pretty simple but I found that uploading the files to the server was a bit tedious. I built the original site in Dreamweaver but when upload the files to Veritas through SSH, I had to go into each of the files and open it in Pico in order for it to work. Otherwise, I would get an error when I try to bring up the page on the web. The error was not specific - it looked like a permission error message but not sure. So every time I make a change in Dreamweaver, I have to upload the file through SSH and open that file in Pico and save it.

>
> Any ideas why this would happen? Please let me know if anyone has any feedback with this issue.
>
> -- Mike


Original Question (excerpt) from Ted Frick, Associate Professor and Web Director, School of Education, Indiana University

------Answer to above ------
From: Frick, Theodore W. Sent: Sunday, February 09, 2003 8:03 AM
To: iu-www@indiana.edu
Cc: Frick, Theodore W.
Subject: Re: [IU-WWW] PHP Question

There are 4 things that need to be done for PHP programs to work correctly in the IU environment (i.e., Veritas, Lux, Viator, Mentor):

  1. The first line of every PHP file must have:

    #!/usr/local/bin/php4

    This is necessary for the CGI version of PHP to run with your account as the owner of the process.

  2. The file format must be unix. In Dreamweaver, you need to set preferences: Edit/Preferences/Code Format/Line Break/LF (Unix)

php screen showing unix format

Actually, once you set up Dreamweaver MX for editing PHP, it's pretty nice. Especially, you need to update two config files on your installation. See:

http://www.macromedia.com/support/dreamweaver/ts/documents/add_ext_mx.htm and add PHTML and PHP4 in appropriate places, so DW recognizes these file extensions.

This is all fresh in my mind, since we're doing a bunch of PHP and Flash in my R641 class, http://www.education.indiana.edu/~frick/r641/

  1. Then for each file that is newly uploaded to Veritas, you need to do a unix: chmod 700 *.phtml (or *.php4 or *.php3). See: changing rights - PC or changing rights - Mac for information on how to change rights through SSH File Transfer Program.

    Necessary so the PHP CGI can execute on your account. After you do this once on each newly uploaded file, then you don't have to do it again on the unix side, and you can edit and upload and replace.

  2. Files must be named with extensions: phtml, php3, or php4

    But NOT the php extension, since UITS (University Information Technology Service) is reserving this for possible use with the PHP module installation should that ever be used.

 

We have a very useful tutorial for getting started in PHP at IU at:

http://education.indiana.edu/~istdept/R547/PHPbasics/template/template.phtml

That covers all this (except for Dreamweaver preferences -- but we do it for Homesite, and the same principles apply to Dreamweaver). Actually, once you set up Dreamweaver MX for editing PHP, it's pretty nice. Especially, you need to update two config files on your installation. See:

http://www.macromedia.com/support/dreamweaver/ts/documents/add_ext_mx.htm and add PHTML and PHP4 in appropriate places, so DW recognizes these file extensions.

This is all fresh in my mind, since we're doing a bunch of PHP and Flash
in my R641 class, http://www.education.indiana.edu/~frick/r641/

--Ted Frick
Associate Professor and Web Director
School of Education
Indiana University
Bloomington, IN 47405-1006, USA

red line
Indiana University Northwest
3400 Broadway - Gary, Indiana 46408
(219) 980-6500
1-888-YOUR-IUN
(1-888-968-7486)

Comments:
Last Updated: 24 October 2006
Tobacco-Free IU Northwest
Copyright 1997– 2008, The Trustees of Indiana University
Copyright Complaints bullet Privacy Statement