• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Resolved require_once() : open_basedir restriction : sfCore.class.php

Wolf359

New Pleskian
Hello,

Our site stopped working (since developer left the project) and we got lots of errors (sqlite and xcache related).
Finally we decided to replace our website's folder (under /var/www/) with one of the backup from last year.
now the error messages changed to this :

mod_fcgid: stderr: PHP Warning: require_once() [<a href='function.require-once'>function.require-once</a>]: open_basedir restriction in effect. File(/home/web/libs/symfony/lib/util/sfCore.class.php) is not within the allowed path(s): (/var/www/vhosts/<domain>.net/:/tmp/) in /var/www/vhosts/<domain>.net/httpdocs/projects/projects/<domain>/project/main/apps/frontend/config/config.php on line 7

mod_fcgid: stderr: PHP Warning: require_once(/home/web/libs/symfony/lib/util/sfCore.class.php) [<a href='function.require-once'>function.require-once</a>]: failed to open stream: Operation not permitted in /var/www/vhosts/<domain>.net/httpdocs/projects/projects/<domain>/project/main/apps/frontend/config/config.php on line 7

mod_fcgid: stderr: PHP Fatal error: require_once() [<a href='function.require'>function.require</a>]: Failed opening required '/home/web/libs/symfony/lib/util/sfCore.class.php' (include_path='.:/opt/plesk/php/5.2/share/pear') in /var/www/vhosts/<domain>.net/httpdocs/projects/projects/<domain>/project/main/apps/frontend/config/config.php on line 7

How should we proceed to solve this error ?
(Symfony version : 2.1.7, Php 5.2, Plesk 12.5.30)

Any help is deeply appreciated !
 
The reason for this error is that your website configuration is using a wrong "home" directory path "/home/web/". That path neither exists on your system, nor is it allowed by the open_basedir setting That probably ought to be "/var/www/vhosts/<domain>.net/httpdocs/" (or a subdirectory of that path if your have installed your website in such a sub directory as it appears to be the case looking at your error message). Check the configuration file of your website. There will normally be one like config.php or config.inc.php, in your case it is located in /projects/projects/<domain>/project/main/apps/frontend/config/config.php. Change the base directory path to your real base directory in line 7 of that file.

I would also like to add that your paths seem to be messed up in general. It normally does not make much sense to have a path like /projects/projects/domain/project/... in your document root directory. So maybe your restore went into the wrong folder to begin with.
 
Thanks for your support !

the content of /var/www/vhosts/<domain>.net/httpdocs/projects/projects/<domain>/project/main/apps/frontend/config/config.php is :
Code:
<?php

// include project configuration
include(SF_ROOT_DIR.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'config.php');

// symfony bootstraping
require_once($sf_symfony_lib_dir.'/util/sfCore.class.php');
sfCore::bootstrap($sf_symfony_lib_dir, $sf_symfony_data_dir);

sfConfig::add(array(
  'sf_web_dir'      => SF_ROOT_DIR.DIRECTORY_SEPARATOR.sfConfig::get('sf_web_dir_name').DIRECTORY_SEPARATOR.SF_APP,
  'sf_upload_dir'   => SF_ROOT_DIR.DIRECTORY_SEPARATOR.sfConfig::get('sf_web_dir_name').DIRECTORY_SEPARATOR.SF_APP.DIRECTORY_SEPARATOR.sfConfig::get('sf_upload_dir_name'),
));

I guess SF_ROOT_DIR variable holds the current value, but I've no clue where it is set..

Currently /home directory contains (first few levels) :
Code:
- ftp
     - <empty>
- web
     - libs
        - sfplugins
        - symfony
        - symfony10
        - vendors

so I guess the developer installed symfony into home ?
In Plesk under websites and domain -> <domain> -> php settings -> "open_basedir" the current value is
Code:
{WEBSPACEROOT}{/}{:}{TMP}{/}

I tried to change it to "none" but it gave an error after searching under /var/www/vhost/ .... . So I changed it back to default.

Agreed, /projects/projects/<domain>/project/ looks messed up, but I'm sure I've extracted to the right directory (I noticed that weird directory structure when I inspected the project the first time).

I'm not a php developer, and don't know why there are 2 symfony directories under /home. but as a java developer, we're trying to set the equivalent of JAVA_HOME, right ?

What should I do next ? What would you check next ?
 
Last edited:
You need to find this file:
SF_ROOT_DIR.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'config.php'

That is where the directory is set. Simply look for /config/config.php that descends from another directory, probably one of the upper directories of the structure. The variable that has a wrong value is SF_ROOT_DIR.

Do not change the basedir setting in PHP. Your website won't work anyway as lon as your SF_ROOT_DIR is pointing to a wrong location.
 
It points to this file (I printed SF_ROOT_DIR.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'config.php' to a file) :

/var/www/vhosts/turkstudent.net/httpdocs/projects/projects/turkstudent/project/main/config/config.php

Content of that file is :
$sf_symfony_lib_dir = '/home/web/libs/symfony/lib';
$sf_symfony_data_dir = '/home/web/libs/symfony/data';

I tried to disable open_basedir in php.ini , the error changed to

Failed opening required '/home/web/[...]var/www/<domain>/../some_file.class'

I enabled it again.

Symfony is installed under /home/web and my project is under /var/www/.
How can I tell php to look at the right places ?
 
I cannot tell you where your symfony directory is, but symfony is a PHP based CMS, so I guess it should be located under /var/www/vhosts/<domain.tld>/httpdocs or a subdirectory. You need to adjust the configuration base paths to the correct location. The current paths point to a directory that probably even does not exist.

This all is not a Plesk issue. If you do not know how to find the correct files and locations or how to configure your CMS, you need to hire an expert, because the case we are discussing here is part of a web design and maintenance process, not part of a web server configuration or Plesk configuration process.
 
Symfony files are indeed under /home/web/lib/... I can see them. There are two bases now. But I agree that's not a Plesk problem, but rather Symfony related.

.. you need to hire an expert ...

well, I'd do that but I'm sure he or she'd demand some kind of compensation.. like a salary :)

Jokes apart, I already opened a thread on stackoverflow under the tag "Symfony".

Thanks for your time !
 
Back
Top