1

I have trouble for requiring a file:

$path_requires = "/var/www/vhosts/website.com/v3" ;

require("$path_requires/vars.inc.php") ;

The error is:

/var/www/vhosts/website.com/portraits Fatal error: require(): Failed opening required '/var/www/vhosts/website.com/v3/vars.inc.php'

If i do from a terminal:

cat /var/www/vhosts/website.com/v3/vars.inc.php

I checked the permissions on the directory. website.com. it's:

drwxr-xr-x 17 apache psaserv 4096 Oct 18 03:32 v3

I changed the permissions to that directory with no success.

Does anyone know what is going on. Why I can't require this php file ?

6
  • Can you show the permissions on the v3 folder and on the .inc.php file ? Commented Oct 30, 2012 at 10:36
  • It's normal that your path require is /var/www/vhosts/website.com/v3 and in your console you ask /var/www/vhosts/bookonlive.com/v3 ? Commented Oct 30, 2012 at 10:37
  • The error message looks in /var/www/vhosts/website.com/, and you cat from /var/www/vhosts/bookonlive.com/ which is not the same folder. Commented Oct 30, 2012 at 10:37
  • I think he's just using website.com as an example folks. Commented Oct 30, 2012 at 10:39
  • v3 folder: drwxr-xr-x 17 apache psaserv 4096 Oct 18 03:32 v3 for the permissions on the file. i don't know. i can't access to the server anymore. connection timeout! Commented Oct 30, 2012 at 10:49

3 Answers 3

1

Chances are it's looking for the /var/www/vhosts folder inside your actual hosting and quite obviously not finding it. Try:

$path_requires = "/v3" ;

require("$path_requires/vars.inc.php") ;
Sign up to request clarification or add additional context in comments.

2 Comments

I have the same error. But there are 2 sub-domains: sub1.mysite.com sub2.mysite.com I have to be able to require a file from one sub1 when the script executed on sub2. That's why I try to require the file from the root system /__/__/etc...
Try adding one level up then, the website.com I am pretty sure what's happening is since it's in a browser it's getting confused by the directory structure. Your site externally (in a browser) is not seeing the internal structure of your web host.
0

Check using this

$path_requires = "https://www.website.com/v3" ; (base url)

require("$path_requires/vars.inc.php") ;

1 Comment

same error.and yet the url is correct! I can access to: v3.mysite.com/vars.inc.php
0

phpinfo() result:

open_basedir    /var/www/vhosts/website.com/portraits/:/tmp/    no value

The /etc/php.ini:

;open_basedir =

How to change the local value ? If I change /etc/php.ini the local value have the upper hand.

/website.com/portraits/ portraits is the directory of the sub-domain portraits.website.com

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.