chybně detekované baseUri
- Filip Procházka
- Moderator | 4668
Zdravím,
na localhostu v pořádku ale na produkčním se mi v $basePath
a $baseUri
objevuje v templatě část url z routeru, kterou
tam nechci
produkční – špatně
<link rel="stylesheet" href="{$basePath}/reset-blueprint.css" type="text/css" />
<link rel="stylesheet" href="/cs/reset-blueprint.css" type="text/css" />
dev – správně
<link rel="stylesheet" href="{$basePath}/reset-blueprint.css" type="text/css" />
<link rel="stylesheet" href="/reset-blueprint.css" type="text/css" />
$baseUri
dělá to stejné, s tím že je tam navíc
doména…
routa
$domain = 'unired.loc'; // nebo 'unired.cz' automaticky doplněno
$router[] = new Route('//www.'.$domain.'/[!<language [a-z]{2,4}>/]<presenter>/<action>', array(
'module' => 'Front',
'presenter' => 'Homepage',
'action' => 'default',
'language' => 'cs'
));
nette last dev – https://github.com/…bfa9d8fba85c
zabilo mi to teď docela aplikaci, všechny obrázky, css a js jsou blbě nalinkované…
večer dyštak zkusím ještě pár checkoutů na starší verze nette abych zjistil, kterej commit to zabil
//aktualizace:
produkční $_SERVER
:
array(33) {
"SCRIPT_URL" => "/cs/" (4)
"SCRIPT_URI" => "http://www.unired.cz/cs/" (24)
"HTTP_HOST" => "www.unired.cz" (13)
"HTTP_CACHE_CONTROL" => "max-age=0" (9)
"HTTP_ACCEPT" => "application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5" (90)
"HTTP_ACCEPT_ENCODING" => "gzip,deflate,sdch" (17)
"HTTP_ACCEPT_LANGUAGE" => "cs-CZ,cs;q=0.8" (14)
"HTTP_ACCEPT_CHARSET" => "windows-1250,utf-8;q=0.7,*;q=0.3" (32)
"SERVER_SIGNATURE" => ""
"SERVER_SOFTWARE" => "Apache" (6)
"SERVER_NAME" => "www.unired.cz" (13)
"SERVER_PORT" => "80" (2)
"DOCUMENT_ROOT" => "/var/www/unired/document_root" (29)
"SERVER_ADMIN" => "HosipLan@gmail.com" (18)
"SCRIPT_FILENAME" => "/var/www/unired/document_root/index.php" (39)
"REMOTE_PORT" => "44684" (5)
"GATEWAY_INTERFACE" => "CGI/1.1" (7)
"SERVER_PROTOCOL" => "HTTP/1.1" (8)
"REQUEST_METHOD" => "GET" (3)
"QUERY_STRING" => ""
"REQUEST_URI" => "/cs/" (4)
"SCRIPT_NAME" => "/cs/" (4)
"PHP_SELF" => "/cs/" (4)
"REQUEST_TIME" => 1290498893
}
$ php -v
PHP 5.3.3-0.dotdeb.1 with Suhosin-Patch (cli) (built: Oct 1 2010 08:49:29)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
with Suhosin v0.9.32.1, Copyright (c) 2007-2010, by SektionEins GmbH
$ aptitude show apache2
Version: 2.2.9-10+lenny8
dev $_SERVER
:
array(33) {
"HTTP_HOST" => "www.unired.loc" (14)
"HTTP_CONNECTION" => "keep-alive" (10)
"HTTP_REFERER" => "http://www.unired.loc/cs/?_fid=10d1" (35)
"HTTP_CACHE_CONTROL" => "max-age=0" (9)
"HTTP_ACCEPT" => "application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5" (90)
"HTTP_USER_AGENT" => "Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/534.7 (KHTML, like Gecko) Chrome/7.0.517.44 Safari/534.7" (108)
"HTTP_ACCEPT_ENCODING" => "gzip,deflate,sdch" (17)
"HTTP_ACCEPT_LANGUAGE" => "cs-CZ,cs;q=0.8" (14)
"HTTP_ACCEPT_CHARSET" => "windows-1250,utf-8;q=0.7,*;q=0.3" (32)
"PATH" => "/usr/local/bin:/usr/bin:/bin" (28)
"SERVER_SIGNATURE" => ""
"SERVER_SOFTWARE" => "Apache/2.2.14 (Ubuntu) PHP/5.3.2-1ubuntu4.5 with Suhosin-Patch mod_python/3.3.1 Python/2.6.5 mod_wsgi/2.8" (105)
"SERVER_NAME" => "www.unired.loc" (14)
"SERVER_ADDR" => "127.0.0.1" (9)
"SERVER_PORT" => "80" (2)
"REMOTE_ADDR" => "127.0.0.1" (9)
"DOCUMENT_ROOT" => "/home/hosiplan/xampp/else/other_webs/unired/document_root" (57)
"SERVER_ADMIN" => "HosipLan@gmail.com" (18)
"SCRIPT_FILENAME" => "/home/hosiplan/xampp/else/other_webs/unired/document_root/index.php" (67)
"REMOTE_PORT" => "43574" (5)
"REDIRECT_URL" => "/cs/" (4)
"GATEWAY_INTERFACE" => "CGI/1.1" (7)
"SERVER_PROTOCOL" => "HTTP/1.1" (8)
"REQUEST_METHOD" => "GET" (3)
"QUERY_STRING" => ""
"REQUEST_URI" => "/cs/" (4)
"SCRIPT_NAME" => "/index.php" (10)
"PHP_SELF" => "/index.php" (10)
"REQUEST_TIME" => 1290498791
}
$ php -v
PHP 5.3.2-1ubuntu4.5 with Suhosin-Patch (cli) (built: Sep 17 2010 13:41:55)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
with Xdebug v2.0.5, Copyright (c) 2002-2008, by Derick Rethans
$ aptitude show apache2
Verze: 2.2.14-5ubuntu8.3
jak na to tak koukám tak asi vím kde je chyba :) ale teď otázka co s tím…
Editoval HosipLan (23. 11. 2010 9:06)
- David Grudl
- Nette Core | 8228
Problém je v tom, že detekce počítá s tím, že PHP_SELF
má být
The filename of the currently executing script, relative to the document root.
Což evidentně není. (Přesněji řečeno, místo PHP_SELF
se
používá SCRIPT_NAME
, což je vlastně totéž, jen neobsahuje
případné pathInfo). Řešením by asi bylo nahradit SCRIPT_NAME
za rozdíl cest SCRIPT_FILENAME
a DOCUMENT_ROOT
.