Dolibarr ERP & CRM » Bugs » bug #873
Problem with DOL_URL_ROOT with NginxLatest modifications
Answer now
Snapshot Details |
Submitted by: | Sébastien Maccagnoni-Munch (tiramiseb) | | Submitted on: | 2013-05-03 12:31 |
Last Modified On: | 2013-05-03 12:31 | |
Summary: | Problem with DOL_URL_ROOT with Nginx |
Description: | I've installed Dolibarr in a subpath on Nginx with FastCGI and PHP-FPM (migration from an Apache serveur with mod_php). With Apache + mod_php, I don't have this problem. I don't know why.
The problem seems to be in filefunc.inc.php, on line 161 :
if ($real_dolibarr_main_document_root == @realpath($pathroot.$concatpath)) // @ avoid warning when safe_mode is on.
- The first exploded path part is always an empty string, because SCRIPT_NAME starts with "/".
- $real_dolibarr_main_document_root is the path to the "htdocs" directory.
- $pathroot (defined as $_SERVER["DOCUMENT_ROOT"]) is the path to the directory where the script is executed, so $pathroot is the path to the "htdocs" directory.
At the first occurrence of the test on line 161, $concatpath = "" and $real_dolibarr_main_document_root = $pathroot ; this test is always true, whatever the real script path is.
To override this, I've changed line 161 :
if (!empty($tmppath) && $real_dolibarr_main_document_root == @realpath($pathroot.$concatpath)) // @ avoid warning when safe_mode is on.
|
Step to reproduce bug: | Install Dolibarr in a subpath on Nginx with FastCGI and PHP-FPM (migration from an Apache serveur with mod_php). |
Version: | 3.3.1 | | Category: | Other |
Severity: | 5 - Major | | OS Type/Version: | |
PHP version: | | | Database type and version: | |
Status |
Status: | Need more info | | Assigned to: | None |
Resolution: | None | |
Comments- Laurent Destailleur 2013-05-03 15:17
- Thanks for analysis. I'm afraid this change will break other cases.
To help me find correct fix, can you provide what exact value you get for
A) realpath($dolibarr_main_document_root)
B) $_SERVER["DOCUMENT_ROOT"]
C) $_SERVER["SCRIPT_NAME"]
D) What is url you type into your browser.
|
|
To help me find correct fix, can you provide what exact value you get for
A) realpath($dolibarr_main_document_root)
B) $_SERVER["DOCUMENT_ROOT"]
C) $_SERVER["SCRIPT_NAME"]
D) What is url you type into your browser.
Open→ Need more info