Ask your Symfony questions! Pay money and get answers fast! (more info)

Why would inclusion of the config file fail intermittently? Symfony

  • SOLVED

On a Symfony 1.0 project, does anyone ever get an intermittent errror like this one?

Warning: include(SF_ROOT_DIR/config/config.php): failed to open stream: No such file or directory in /home/public/microsoft/apps/exchange/config/config.php on line 4

Warning: include(): Failed opening 'SF_ROOT_DIR/config/config.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /home/public/microsoft/apps/exchange/config/config.php on line 4

Warning: require_once(/util/sfCore.class.php): failed to open stream: No such file or directory in /home/public/microsoft/apps/exchange/config/config.php on line 7

Fatal error: require_once(): Failed opening required '/util/sfCore.class.php' (include_path='.:/usr/share/php:/usr/share/pear') in /home/public/microsoft/apps/exchange/config/config.php on line 7


Right now we have several deevelopers working on separate machines, each with a local copy of the software. All of them occasionally get this error. Anyone familiar with this?

Answers (2)

2010-08-03

Gordon Franke answers:

i think your web/index.php or web/frontend_dev.php is not correct it must define the SF_ROOT_DIR constant

example:

define('SF_ROOT_DIR', realpath(dirname(__FILE__).'/..'));
define('SF_APP', 'frontend');
define('SF_ENVIRONMENT', 'dev');
define('SF_DEBUG', true);

require_once(SF_ROOT_DIR.DIRECTORY_SEPARATOR.'apps'.DIRECTORY_SEPARATOR.SF_APP.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'config.php');

sfContext::getInstance()->getController()->dispatch();


can you post your config/config.php and your web/index.php

2010-08-03

Jakub Zalas answers:

Do you mount directories with your source code? In some cases mounted shares can make the files not readable/accessible.

Anyway it seems you have something uncommon in your config/config.php file. Usually there are only two variables defined (paths to symfony libs):


<?php

// symfony directories
$sf_symfony_lib_dir = '/usr/share/php/symfony';
$sf_symfony_data_dir = '/usr/share/php/data/symfony';