Using PHP on Panix

mod_php - DEPRECATED
We are no longer supporting mod_php, as the latest version which runs in safe mode (which we required on the shared webservers) is no longer maintained or patched. Should you require the performance level mod_php provides, it is available with your preferred version of php with the virtual add-on to Standard Web service.

cgi script
As a script, you need to add the line "#!/usr/local/bin/php" to the beginning of the file and use the .cgi extension, just as you would with any other cgi script. The stand-alone version is not run in safe mode. The latest version of php is 7.0, which you can use by making the first line of the file
#!/usr/local/bin/php-7.0
.
php handler
Due to safe-mode restrictions, php-based sites (those built in Wordpress, for example) hosted on the shared webservers will need to convert.php pages into .cgi calls by using a php-handler script. This is a .cgi script with the following contents:

#!/bin/sh

cd `dirname ${PATH_TRANSLATED}`
exec php
Calling 'exec php' runs the standalone version of php, currently in version 5.3. If you need to run the latest version, php 7.0 in your handler, use 'exec php-7.0' instead.
Name it it "php-handler.cgi" and place it in your pcgi-bin directory. Set permissions to u+x, to give yourself permission to execute it.
The directory in which you are running php should have a .htaccess file whose contents include the following:
AddHandler php-handler .php
If you do not have your own domain, add this:
Action php-handler /~yourusername/pcgi-bin/php-handler.cgi
and if you have your own domain, add this:
Action php-handler /pcgi-bin/php-handler.cgi
For step-by-step instructions in the context of setting up a Wordpress blog, see the WordPress help file. We also provide a help page for Drupal 7.
session files
If you need to use PHP session files, you must take these steps to make it work properly and be secure.
  1. You cannot store these files in a public area. You need to define the session directory to be under your web space and read/write only to your username. Please DO NOT USE /tmp or any subdirectory of /tmp for these files. It exists separately on each of our web server hosts, so using it is guaranteed to fail sometimes.
  2. You must use the CGI version. The apache mod_php version runs as the user of the web server which makes it possible for another customer to view your session files. (The likeliest scenario for this is if a malicious person breaks into another site.) This also gets around safe mode restrictions.
virtual server
People who need it to "just work" and specifically need mod_php need their own server. This need not be an actual dedicated machine, as the virtual add-on will provide exactly this functionality. For such users, we can optionally have the web server run as their username and/or turn off safe mode.
For reference material about PHP, please visit PHP's home page.


Last Modified:Monday, 04-Apr-2016 17:19:53 EDT
© Copyright 2006-2011 Public Access Networks Corporation