Community « Discussion forum « Installation support « web address != to physical directory, install problem «
Comment: web address != to physical directory, install problem
| << Previous | Next >> |
I found the problem. When the configure.php file is loaded $_REQUEST has these varibles set:
This PHP install is running as a cgi script, not an apache mod. The first 3 are used in the following snipit of code from 'shared/global.php'
In the 'control/configure.php' the form action is set via
The
Given all the variable values above
The PHP documentation on the predefined variable PHP_SELF is:
This obviously isn't accurate when your useing a subdomain, because it maps relative to the document root, in this case the document root is is / and the script is running at /blog. But because of the sub-domain mapping that isn't the url to access the files.
I belive a safer version of self-discovery for the 'self_url' would be to use the following predefined variables:
Variables that shouldn't be used, because they are useless for CGI installs of PHP are:
A clue that php is being run as CGI:
A clue that a sub-domain is being used:
And on a side note the editing of these comments has some other bugs. I tried to use the php block to highlight the bit of code I quoted but when I enclosed the code in the tag it just deleted it. Also your not stripping the slashes when you display the text in the edit box. "preg_match('/\\.php$/')" that phrase when you edit the text and save, it will contiune to add slashes (you can see above an example of it with a few edits in, lots of slashes).
[PHP_SELF] => /blog/control/configure.php
[PATH_INFO] => /blog/control/configure.php
[SCRIPT_NAME] => /cgi-bin/php
[REQUEST_URI] => /control/configure.php
This PHP install is running as a cgi script, not an apache mod. The first 3 are used in the following snipit of code from 'shared/global.php'
// the url to be used for self-referencing in forms
if(preg_match('/\\.php$/', $_SERVER['PHP_SELF']))
$here = $_SERVER['PHP_SELF'];
elseif(preg_match('/\\.php$/', $_SERVER['PATH_INFO']))
$here = $_SERVER['PATH_INFO'];
elseif(preg_match('/\\.php$/', $_SERVER['SCRIPT_NAME']))
$here = $_SERVER['SCRIPT_NAME'];
$context['self_url'] = $here;
In the 'control/configure.php' the form action is set via
action="'.$context['self_url'].'"The
$context['self_url'] is equal too [self_url] => /blog/control/configure.phpGiven all the variable values above
preg_match('/\\\\\\\\.php$/', $_SERVER['PHP_SELF']) will evaulate as true, and 'self_url' will be set to the value of $_SERVER['PHP_SELF']The PHP documentation on the predefined variable PHP_SELF is:
" The filename of the currently executing script, relative to the document root. For instance, $_SERVER['PHP_SELF'] in a script at the address http://example.com/test.php/foo.bar would be /test.php/foo.bar. "
This obviously isn't accurate when your useing a subdomain, because it maps relative to the document root, in this case the document root is is / and the script is running at /blog. But because of the sub-domain mapping that isn't the url to access the files.
I belive a safer version of self-discovery for the 'self_url' would be to use the following predefined variables:
[SCRIPT_URL] => /control/configure.php
[REQUEST_URI] => /control/configure.php
Variables that shouldn't be used, because they are useless for CGI installs of PHP are:
[SCRIPT_NAME] => /cgi-bin/php
[SCRIPT_FILENAME] => /cgi-bin/php
A clue that php is being run as CGI:
[GATEWAY_INTERFACE] => CGI/1.1
A clue that a sub-domain is being used:
[HTTP_HOST] => blog.raeky.com
[SERVER_NAME] => www.raeky.com
[SCRIPT_URI] => http://www.raeky.com/control/configure.php
by Raeky on Aug. 1 2004
