These are the notes for Tue Jun 30 started at 15:33:59 EDT 2009 Lecture goals for today: a) finish installing PHP b) set up password protected folder c) post Homework One Last time we installed MySQL and we started installing PHP. Start by going into cd /nobackup/dgerman/php-5.1.4 Yesterday we created a file step005 and we run it. Page 51 in http://www.cs.indiana.edu/~dgerman/eowp06.pdf has the instructions. Next create a file (and call it step006) with this content: make make install Then make the file executable and run it. We wait... maybe 10-12 minutes. Meanwhile why don't we set up the protected folder. The instructions are in the text chapter 6 pp. 33-34. a) first create a protected folder in htdocs the name should be: protected and it's in htdocs mkdir ~/apache/htdocs/protected b) set up a file (named passwd) with usernames and passwords you need to use a special utility to do that the utility is delivered with apache, so you have it but I would like to have the same password (and username) to access all websites but you should not know my password so I should give you my encrypted password one way would be for you to create with pico ~/apache/passwd then add this as the first line: dgerman:UIaTPpE.ZpwHw then exit and save the file another way would be to copy /u/dgerman/public/passwd in ~/apache/passwd cp /u/dgerman/public/passwd ~/apache/passwd So either way it's fine. Now you have the right starting point for this file. Now you need to start using ~/apache/bin/htpasswd to add users. I run this command: -bash-3.2$ ~/apache/bin/htpasswd -b ~/apache/passwd lbird dribl Adding password for user lbird The file now becomes: -bash-3.2$ cat ~/apache/passwd dgerman:UIaTPpE.ZpwHw lbird:13rXCyijE6/QE -bash-3.2$ Then take this code: AuthName Protected AuthType Basic AuthUserFile /u/[username]/apache/passwd require user [instructor] require user [username] Then open the file: pico -w ~/apache/conf/httpd.conf And go to line 125 or so (^W, ^T, 125). For me it looks like this: # you might expect, make sure that you have specifically enabled it # below. # <-----------(line 125) # # This should be changed to whatever you set DocumentRoot to. # Copy the code there. Change the [username] into your username. Change [instructor] into dgerman. Save and exit. Check that the file is still having good syntax: -bash-3.2$ ~/apache/bin/apachectl configtest Syntax OK -bash-3.2$ Now go to protected and create some files there. pico ~/apache/htdocs/protected/homeworkOne.txt Type something in it, save and exit. Then pico ~/apache/htdocs/protected/homeworkTwo.txt Type something in it, save and exit. And now restart the server, then access protected: ~/apache/bin/apachectl restart Protected is available from: http://silo.cs.indiana.edu:44xxx/protected Now let's go back to finishing the PHP installation. Copy php.ini-dist from /nobackup/username/php-5.1.4 to ~/apache/conf/php.ini (changing its name in the process): cp php.ini-dist ~/apache/conf/php.in Then go to -bash-3.2$ cd ~/apache/conf -bash-3.2$ ls -ld php.ini -rw-r--r-- 1 dgerman faculty 41989 Jun 30 16:42 php.ini -bash-3.2$ pico php.ini Change the file: a) turn line 892 into session.save_path = "/u/username/apache/phpsessions" b) turn line 399 into register_globals = On Then exit and save. Open ~/apache/conf/httpd.conf Go to line 304 (or so) and paste these two lines: AddType application/x-httpd-php .php .phtml AddType application/x-httpd-php-source .phps That comes for me after # #AddType application/x-gzip .tgz Now exit, save, stop the server -bash-3.2$ ~/apache/bin/apachectl stop and start the server. -bash-3.2$ ~/apache/bin/apachectl start Your PHP is installed, we just have to demonstrate it. Create a file called one.php in ~/apache/htdocs: pico ~/apache/htdocs/one.php The contents is: Save, exit then call this from a browser: http://silo.cs.indiana.edu:44xxx/one.php The result is a lot of output with your PHP settings.