bubbaQ Posted August 10, 2010 Share Posted August 10, 2010 -Beta2 broke running of .php code outside the unRAID wrapper: http://192.168.0.51/Pman <=== works http://192.168.0.51/Pman.php <=== does not work Can't pull images out of a subdir of webGui: http://192.168.0.51/bubba/caution.png Although they work OK in .page files Link to comment
limetech Posted August 10, 2010 Share Posted August 10, 2010 The 'document root' is /usr/local/emhttp so for your 'caution.png' file, it would need to exist in /usr/local/emhttp/bubba/caution.png or better, /usr/local/emhttp/plugins/bubba/caution.png (and url is http://192.168.0.51/plugins/bubba/caution.png). Something else to be aware of... at present, if the first component of a pathname starts with a capital letter, emhttp will treat as a "page" and will invoke 'template.php', passing the path in a querystring. See /usr/local/plugins/webGui/template.php. Speaking of wrappers... I will be creating a 'wrapper' PHP file that fills in certain globals such as _GET[]. Code would look something like this: <?php // for http://tower/filename.php?querystring // wrapper.php invoked like this: // /usr/bin/php wrapper.php filename.php querystring parse_str(str_replace("+","%2B",$argv[2]), $_GET); include $argv[1]; ?> Link to comment
bubbaQ Posted August 15, 2010 Author Share Posted August 15, 2010 There is a bug in using: parse_str(str_replace("+","%2B",$argv[2]), $_GET); php's parse_str() function hoses up periods in the string... converts them the underscores. I'm using this now: $_GET = array(); foreach (explode("&", str_replace("+","%2B",$argv[1])) as $item) { list($k, $v) = array_map("urldecode", explode("=", $item)); $_GET[$k] = $v; } If someone is also using php_cgi, they can test for unRAID's php+cli using: if (php_sapi_name() =="cli") { // unRAID php_cli is in use } else { // real php_cgi is in use } Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.