[ Note: as of 8.29.2001 this fiel is obsolete since smj has installed the
  php4 module directly into Apache, yay! ]

How to get PHP on freeshell.org

1. make a symlink to /usr/local/bin/php in your /html directory somewhere,
   I put mine in cgi-bin:

	ln -s /usr/local/bin/php ~/html/cgi-bin/php.cgi

   Of course, you actually need a cgi-bin directory there to begin with.
   Also note the .cgi extension so Apache knows you want to run the cgi.

2. edit your .htaccess file so Apache knows how to handle the scripts:

	Action application/x-httpd-php /~ivan/cgi-bin/php.cgi
   Obviously replacing the "ivan" with your own username, and the path to
   the path where you symlinked php. Also note that it'd be best to put the
   .htaccess in your /html directory so php scripts will work in any
   subdirectories under that. Oh yea, and it works even with the hostnames.

2a. edit your .htaccess some more for index.php:

    Tacker: agent (Matthew J. Davis)
    Subject: regarding .. How to get PHP working
    Date: 18-Jul-01

    Also, add the following line to make index.php your default page...

    DirectoryIndex index.php

    If you want further default pages, add them to the end of the line.

3. make PHP files to your heart's content without needing to bug smj to
   compile the Apache module. :)

This idea was originally suggested in a post by alison on the GENERAL
board. Thanks! :) Also, it'd be nice if we had a global link to php
(ie, http://www.freeshell.org/cgi-bin/php.cgi). Maybe that'd be another
thing to bug smj about. *grin*

Also, some people mentioned the extra output coming from PHP when writing
scripts for use as cgi's. You can get rid of the extra PHP header output
with a shebang like this:

    #!/usr/local/bin/php -q

Hope this helps. :)

Ivan P Tse
ivan [at] freeshell.org


Creative Commons License
This site is licensed under a Creative Commons License.

contact :: ivan tse :: source