aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--cgi/README16
-rwxr-xr-xcgi/php.cgi7
-rw-r--r--cgi/php.ini10
-rw-r--r--conf/common.inc.php3
-rw-r--r--conf/config.php4
5 files changed, 37 insertions, 3 deletions
diff --git a/cgi/README b/cgi/README
new file mode 100644
index 0000000..734e4f0
--- /dev/null
+++ b/cgi/README
@@ -0,0 +1,16 @@
1These are for the case of running under a web server that doesn't support
2PHP directly. In the case that prompted this, thttpd is the server
3software. It'll likely work for others as well, none have been tested.
4
5To install this -
6
7* Copy both files to your web servers document root.
8* php.cgi should be executable.
9* add php.cgi to the base of your urls for PHP pages, so -
10 http://example.com/my/php/project/index.php
11 becomes -
12 http://example.com/php.cgi/my/php/project/index.php
13 Or for a typical apt-panopticon install -
14 http//:example.com/php.cgi/apt-panopticon/apt-panopticon_cgp/index.php
15* For apt-panopticon, pass --cgi to it, so it'll construct URLs properly.
16* Your PHP code may need to be adjusted, cgp has already been adjusted.
diff --git a/cgi/php.cgi b/cgi/php.cgi
new file mode 100755
index 0000000..746ba82
--- /dev/null
+++ b/cgi/php.cgi
@@ -0,0 +1,7 @@
1#!/bin/bash
2
3# Wrap PHP for web servers that can only do PHP via CGI.
4export DOCUMENT_ROOT=$(pwd)
5export SCRIPT_FILENAME="$PATH_TRANSLATED"
6export SCRIPT_NAME=$(basename $PATH_TRANSLATED)
7exec /usr/bin/php-cgi --php-ini ${DOCUMENT_ROOT}/php.ini
diff --git a/cgi/php.ini b/cgi/php.ini
new file mode 100644
index 0000000..7c53490
--- /dev/null
+++ b/cgi/php.ini
@@ -0,0 +1,10 @@
1[PHP]
2
3; cgi.force_redirect is necessary to provide security running PHP as a CGI under
4; most web servers. Left undefined, PHP turns this on by default. You can
5; turn it off here AT YOUR OWN RISK
6; **You CAN safely turn this off for IIS, in fact, you MUST.**
7; ** Seems the same thing applies to thttpd, you MUST turn it off. **
8; http://php.net/cgi.force-redirect
9;cgi.force_redirect = 1
10cgi.force_redirect = 0
diff --git a/conf/common.inc.php b/conf/common.inc.php
index 506134d..07a7475 100644
--- a/conf/common.inc.php
+++ b/conf/common.inc.php
@@ -2,9 +2,6 @@
2 2
3require_once 'config.php'; 3require_once 'config.php';
4 4
5$CONFIG['webdir'] = preg_replace('/\/[a-z\.]+$/', '', $_SERVER['SCRIPT_FILENAME']);
6$CONFIG['weburl'] = preg_replace('/(?<=\/)[a-z\.]+$/', '', $_SERVER['SCRIPT_NAME']);
7
8if (!ini_get('date.timezone')) { 5if (!ini_get('date.timezone')) {
9 date_default_timezone_set($CONFIG['default_timezone']); 6 date_default_timezone_set($CONFIG['default_timezone']);
10} 7}
diff --git a/conf/config.php b/conf/config.php
index eae3307..23a3a90 100644
--- a/conf/config.php
+++ b/conf/config.php
@@ -3,6 +3,10 @@
3# collectd version 3# collectd version
4$CONFIG['version'] = 5; 4$CONFIG['version'] = 5;
5 5
6# Do this here, so it can be overriden, usually in case part of the path is a script for wrapping PHP.
7$CONFIG['webdir'] = preg_replace('/\/[a-z\.]+$/', '', $_SERVER['SCRIPT_FILENAME']);
8$CONFIG['weburl'] = preg_replace('/(?<=\/)[a-z\.]+$/', '', $_SERVER['SCRIPT_NAME']);
9
6# collectd's datadir 10# collectd's datadir
7$CONFIG['datadir'] = '../apt-panopticon/rrd'; 11$CONFIG['datadir'] = '../apt-panopticon/rrd';
8 12