defacto
defacto

Reputation: 359

php require file

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 ?

Upvotes: 1

Views: 171

Answers (3)

defacto
defacto

Reputation: 359

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

Upvotes: 0

Elby
Elby

Reputation: 1674

Check using this

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

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

Upvotes: 0

Rick Calder
Rick Calder

Reputation: 18715

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") ;

Upvotes: 1

Related Questions