Question

We are using a VPS server in our company and I'm trying to install Roundcube webmail interface

But I can't even get to the configuration phase because the set_include_path function doesn't work and the script can't find the required configuration files.

I get an error like "Fatal Error, ini_set/set_include_path function does not work."

I assume some php settings is causing this but I don't which one.

I'd be glad if I could get some help.

Thanks in advance

//EDIT Here is the codes from the 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';
Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top