Closed GoogleCodeExporter closed 9 years ago
Thanks for the patch. Can you post/e-mail me
realpath($_SERVER['DOCUMENT_ROOT']) on
your system? I fear this patch would break working code on hundreds of systems;
I
will try it myself and run unit tests when I'm back in town.
Original comment by mrclay....@gmail.com
on 18 Nov 2008 at 4:07
realpath($_SERVER['DOCUMENT_ROOT']) returns '/usr/local/corpwebsite/webroot';
Original comment by e...@hpuls.no
on 18 Nov 2008 at 8:12
Any more information needed regarding this issue?
Original comment by e...@hpuls.no
on 4 Dec 2008 at 3:58
Yes, sorry. I should've asked for more. Could you put this script inside
DOC_ROOT/
min/ and send me the output?
<?php
header('Content-Type: text/plain');
echo $_SERVER['DOCUMENT_ROOT'], "\n"
,realpath($_SERVER['DOCUMENT_ROOT']), "\n"
,$_SERVER['SCRIPT_FILENAME'], "\n"
,realpath($_SERVER['SCRIPT_FILENAME']), "\n";
?>
Just trying to establish the off-by-one issue that seems to exist only on your
server. Did you check the unit tests before/after making your change?
Original comment by mrclay....@gmail.com
on 4 Dec 2008 at 4:43
Output of that script was:
/usr/local/corpwebsite/webroot/
/usr/local/corpwebsite/webroot
/usr/local/corpwebsite/webroot/min/docrootest.php
/usr/local/corpwebsite/webroot/min/docrootest.php
I didn't check the unit tests, but will install them and come back with output
before/after modification.
Original comment by e...@hpuls.no
on 4 Dec 2008 at 8:11
DOCUMENT_ROOT is incorrect in the $_SERVER array (maybe coming from httpd.conf
or
vhosts.conf). It's a directory path and should not contain a trailing slash. I
also
just ran across a case where DOCROOT was way off. Here's a dirty workaround for
the
moment (I'm out of town): In /min/config.php add this code:
// strip '/min/config.php' off the end of __FILE__
$_SERVER['DOCUMENT_ROOT'] = substr(__FILE__, 0, strlen(__FILE__) - 15);
Let me know how this does. I don't know if it can fix the unit tests.
Original comment by mrclay....@gmail.com
on 10 Dec 2008 at 1:06
Ok, the issue was too a DOCROOT set in httpd.conf with a trailing slash.
Even if it's not up to the spec, I suspect that a lot of people have done that,
and apache doesn't warn on it on
"configtest" either. Possible solution would be to check if the docroot
contains trailing slash?
I have fixed the docroot in the httpd.conf file for my own sites now, but it
might be useful to include it or
perhaps add it to the FAQ.
Thanks for all the help, Minify rocks! :)
Original comment by e...@hpuls.no
on 11 Dec 2008 at 9:44
R275 adds a unit test for a properly configured DOCUMENT_ROOT and provides a
link to
the above workaround if inproper.
Original comment by mrclay....@gmail.com
on 16 Dec 2008 at 5:18
Hi,
I run min_unit_tests/test_environment.php in my IIS+PHP but after 60 seconds it
returns blank page.
I've checked that DOCUMENT_ROOT is "c:/inetpub/www", but my application is in a
completely different folder "C:/OtherAppsDir/myAppFolder".
Do you know where could I change this?
Original comment by osca...@gmail.com
on 23 Dec 2008 at 11:20
@oscarml: Comment 6 above has a workaround for fixing
$_SERVER['DOCUMENT_ROOT']. I'd
love to know why test_environment.php hung up. Can you check your PHP error
log? Not
sure where that would be on IIS.
Original comment by mrclay....@gmail.com
on 23 Dec 2008 at 5:24
In case this helps anyone reading this thread, I use a similar (but generic)
version
of the work-around suggested on comment 6:
//----------------
$_SERVER['DOCUMENT_ROOT']=str_replace('\\','/',substr($_SERVER['SCRIPT_FILENAME'
],0,0
-strlen($_SERVER['PHP_SELF'])));
//----------------
And it that doesn't work, you can also try:
//----------------
$_SERVER['DOCUMENT_ROOT'] = str_replace( '\\', '/', substr(str_replace('\\\\',
'\\',
$_SERVER['PATH_TRANSLATED']), 0, 0-strlen($_SERVER['PHP_SELF'])));
//----------------
I've used it for a while to fix document_root for other php applications on
windows
servers... Interestingly enough, the documentation says minify takes case of
this
issue on version 2 but that didn't work for me.
Original comment by diego.a...@gmail.com
on 22 Apr 2009 at 2:24
Original issue reported on code.google.com by
e...@hpuls.no
on 18 Nov 2008 at 10:38