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: Wed, 18 Sep 2013 20:40:22 +0200

Doliforge
Ce message ne s'affiche pas correctement?
mettez à jour vos préférences utilisateur.

Problem with DOL_URL_ROOT with Nginx

Dernières modifications

18/09/2013 20:40 (Europe/Paris)

Répondre

État

 Détails
Submitted by:  Sébastien Maccagnoni-Munch (tiramiseb) Submitted on:  03/05/2013 12:31
Last Modified On:  18/09/2013 17:40 
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:  
 Etat
Status:  Need more info Assigned to:  Aucun
Resolution:  Aucun 

Commentaires

Sébastien Maccagnoni-Munch 18/09/2013 20:40
$dolibarr_main_url_root='https://corp.smm-informatique.fr/dolibarr';
Laurent Destailleur 18/09/2013 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 03/05/2013 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 03/05/2013 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]