World Class Web Hosting
+1.877 724-7638

my pair account webmail

Web hosting services

 

  • pairNIC - domain name registration (as low as $13/year)
  • pair reseller program - reselling our Web site hosting services
  • pair Networks does not offer "Business Associate" services under HIPAA

about pair Networks

 

Contact Us

pairNIC Support

blog.pair.com

Call Us

  • +1.877 724-7638
  • +1.412 381-7247

Fax

  • +1.412 381-9997

E-mail Us

Web contact forms

Mailing Address

  • pair Networks, Inc.
    Suite 210
    2403 Sidney Street
    Pittsburgh, PA 15203-2168

support - knowledge base

 

Authoring/Development - php-CGIwrap

Modifications Required:

none

Optional Modifications:

None allowed. To run correctly, php-cgiwrap requires special privileges.

php-cgiwrap is a "script wrapper" that lets your scripts execute under your own userid and group instead of user nobody and group www. It works in the same fashion as cgiwrap but handles paths in such a way that it can be used to run PHP pages under your own userid. Running PHP pages under your own userid allows you to use chmod 700 to lock out other users on the server from viewing the source code. Locking out other users can be especially important if you are interfacing with a MySQL database, thereby preventing people from obtaining your password.

To use PHP 5 with php-cgiwrap, you must first copy php5.cgi to your own Web directory's (public_html) cgi-bin directory by SSH:

  cp /usr/www/cgi-bin/php5.cgi ~/public_html/cgi-bin/
  chmod 755 ~/public_html/cgi-bin/php5.cgi

(For PHP 4, copy the file php4.cgi from the same directory instead.)

You must then add the following lines to your .htaccess file (please note that this code should be two lines in length with a space before "/cgi-sys"):

  Action application/x-pair-sphp5 /cgi-sys/php-cgiwrap/USERNAME/php5.cgi
  AddType application/x-pair-sphp5 .php

USERNAME should be replaced with your account username. The .htaccess file mentioned above is a plain text file of that name and can be used to configure certain Web settings. If you do not already have a .htaccess file, you can create a regular file with that name to use. This should be placed into the Web directory containing the scripts you wish to wrap.

Once this is done, all .php files are run under your own user ID. If you want to use a different file extension, replace .php on the second line with whatever you prefer.

The example above only works if you are using your own domain name. If you wish to use the server name in the URL for the page you are accessing, you must add the following lines to your .htaccess file:

  Action application/x-pair-sphp5 /cgi-sys/php-cgiwrap/USERNAME/php5.cgi/users/
  AddType application/x-pair-sphp5 .php

As in the other example, USERNAME should be replaced with your account username.

These URLs run the non-debugging version of php-cgiwrap; if you want to use the debugging features, replace php-cgiwrap with php-cgiwrapd.

For more details on using cgiwrap, please visit our cgiwrap Knowledge Base article page.