How to install and configure PHP on a FirstClass Server


The following is provided as a sample installation instruction set.  Various builds of PHP, and PHP scripts may require special attention which will not be covered in this document.

1. Visit http://php.net to download the version of PHP most suited to your needs and install PHP into a directory of your choosing on the machine running your FirstClass Internet Services.  If you are running Linux or OS X, these operating systems come with PHP installed. To check the path, type (from a terminal window), whereis php

2. Located in the PHP installation directory is a file called "php.ini-dist", please rename this file to "php.ini" .

3. Edit the entry extension_dir = "./"  in the php.ini you just created to read extension_dir = "ext/"

4. Your PHP scripts need to run from the <drive>\FCServer\cgi-bin\ (Windows); /Library/FirstClass Server/cgi-bin/ (OS X); and /opt/fcsd/cgi-bin/ (Linux)  If there isn't one, create it. We suggest that you create folders to keep your applications separate. Example c:\fcserver\cgi-bin\app1 or /opt/fcsd/cgi-bin/app2 etc

5. Log on to your FirstClass Server as Admin.

6. You will likely need to alias the application folder you created in step 4 above to the website your working on
- From the Volumes folder from the admin desktop
- Double click on the drive that contains your server and CGI-BIN folders.  
- Open the CGI-BIN folder
- Right click on the Application folder you created, and select "Add to Desktop". This will create a folder on the admin desktop that needs to be moved to "Internet Services:www:Sitename"  (example Main Site).  
- Some applications you will create may request access to the root of the web directory, in which case, ALSO create an alias to the root of WWW.

7. Open Internet Services/Add Handler, and add the following:
<AddHandler .php>
SITE: *
#If running PHP as an executable uncomment the following line
#EXEC: c:\php\php.exe
#If running PHP as an ISAPI, uncomment the following line
#ISAPI.ext: c:\php\php5isapi.dll
</AddHandler>

<AddURLHandler ~ /app1/\(.+\)\.php\(.*\)>
Site: *
Rewrite: /cgi-bin/app1/\1.php\2
</AddURLHandler>

Test your application with HTTP Server logging turned up to level 4. If your test yields 404 errors (not found), you will need to add more AddURLHandler entries, and/or add aliases (step 6) to the subfolders in the application folder (Step 4). Also, in some cases, the name of your aliases may need to change (too long, conflicts with others)

fcss0.jpg


Copyright© 2008 Open Text Corporation. All Rights Reserved.