Funzione set_include_path non funziona, PHP 5.2.13
-
27-10-2019 - |
Domanda
Stiamo utilizzando un server VPS nella nostra azienda e sto cercando di installare Roundcube webmail interfaccia
Ma non può nemmeno arrivare alla fase di configurazione perché la funzione set_include_path non funziona e lo script non riesce a trovare i file di configurazione necessari.
ottengo un errore come "Errore fatale, ini_set / set_include_path funzione non è attiva."
Presumo alcune impostazioni di PHP è che causano questo, ma non lo faccio quale.
Sarei felice se potessi avere un aiuto.
Grazie in anticipo
// EDIT Ecco i codici dallo script
ini_set('error_reporting', E_ALL&~E_NOTICE);
ini_set('display_errors', 1);
define('INSTALL_PATH', realpath(dirname(__FILE__) . '/../').'/');
define('RCMAIL_CONFIG_DIR', INSTALL_PATH . 'config');
$include_path = INSTALL_PATH . 'program/lib' . PATH_SEPARATOR;
$include_path .= INSTALL_PATH . 'program' . PATH_SEPARATOR;
$include_path .= INSTALL_PATH . 'program/include' . PATH_SEPARATOR;
$include_path .= ini_get('include_path');
set_include_path($include_path);
require_once 'utils.php';
require_once 'main.inc';
Soluzione
I'm doing this from memory, so it might not be quite right, but I think maybe you are confusing the path and directory separators. There may also be a nicer way to do this than what you are doing (i.e. assembling the whole path at once). Try something like this:
define('INSTALL_PATH', dirname(dirname(__FILE__)));
set_include_path(get_include_path() . PATH_SEPARATOR . INSTALL_PATH . DIRECTORY_SEPARATOR . 'program' . DIRECTORY_SEPARATOR . 'lib');
set_include_path(get_include_path() . PATH_SEPARATOR . INSTALL_PATH . DIRECTORY_SEPARATOR . 'program' . DIRECTORY_SEPARATOR . 'include');
set_include_path(get_include_path() . PATH_SEPARATOR . INSTALL_PATH . DIRECTORY_SEPARATOR . 'program');
Usually I compress this a little bit with implode, since DIRECTORY_SEPARATOR
is so verbose:
...PATH_SEPARATOR . implode(DIRECTORY_SEPARATOR, Array(INSTALL_PATH, 'program', 'lib'));
I think by (most importantly) changing some of your PATHs to DIRECTORYs, and (possibly) using incremental get_include_path
and set_include_path
calls, it will be more readable, portable and just might work properly.