dolibarr-bugtrack
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dolibarr-bugtrack] [Bug #873] Problem with DOL_URL_ROOT with Nginx


From: Doliforge
Subject: [Dolibarr-bugtrack] [Bug #873] Problem with DOL_URL_ROOT with Nginx
Date: Thu, 28 Nov 2013 13:59:37 +0100

Doliforge
Is this email not displaying correctly?
update email preferences.

Problem with DOL_URL_ROOT with Nginx

Latest modifications

2013-11-28 13:59 (Europe/Paris)
The bug has been corrected inside GIT sources
(http://www.github.com/Dolibarr/dolibarr).

So fix should be available with next stable release.

Answer now

Snapshot

 Details
Submitted on:  2013-05-03 12:31 Last Modified On:  2013-09-18 20:40
Submitted by:  Sébastien Maccagnoni-Munch (tiramiseb) 
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).
Detected in 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-11-28 13:59
The bug has been corrected inside GIT sources
(http://www.github.com/Dolibarr/dolibarr).

So fix should be available with next stable release.
Sébastien Maccagnoni-Munch 2013-09-18 20:40
$dolibarr_main_url_root='https://corp.smm-informatique.fr/dolibarr';
Laurent Destailleur 2013-09-18 17:40
There is some case where autodetection can't work,like when using apache "alias" or using nginx.

In such cases, you must set the parameter
$dolibarr_main_url_root='https://corp.smm-informatique.fr/dolibarr/'
into your conf.php file

What was its value ?

Sébastien Maccagnoni-Munch 2013-05-03 15:29
A) realpath($dolibarr_main_document_root) : /srv/smmi-corp/dolibarr/htdocs
B) $_SERVER["DOCUMENT_ROOT"] : /srv/smmi-corp/dolibarr/htdocs
C) $_SERVER["SCRIPT_NAME"] : /dolibarr/index.php
D) URL : https://corp.smm-informatique.fr/dolibarr/


Also, NginX configuration is :

location /dolibarr {
alias /srv/smmi-corp/dolibarr/htdocs;
index index.php;
location ~ \.php$ {
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_param SCRIPT_FILENAME /srv/smmi-corp/dolibarr/htdocs$fastcgi_script_name;
include fastcgi_params;
}
}
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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]