In this answer, I assume the following, going by your question:
- Your WordPress site is at
/var/www/html
- Your WordPress sites’s full config file is at
/var/www/wp-config.php
- There is a small file at
/var/www/html/wp-config.php
that (ideally) will load/var/www/wp-config.php
- Your
/var/www/wp-config.php
contains all the necessary content to run your WordPress site (ie, the code fromwp-config-sample.php
, updated as appropriate with your DB information, etc). - There are no other WordPress installations in
/var/www/*
Given all that, your /var/www/html/wp-config.php
file should contain the following:
<?php
/** Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
define('ABSPATH', dirname(__FILE__) . "https://wordpress.stackexchange.com/");
/** Location of your WordPress configuration. */
require_once(ABSPATH . '../wp-config.php');
or
/** Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
define('ABSPATH', dirname(__FILE__) . "https://wordpress.stackexchange.com/");
/** Location of your WordPress configuration. */
require_once(ABSPATH . '/var/www/wp-config.php');
From your /var/www/html
directory, the path ../var/www/wp-config.php
is looking for /var/www/var/www/wp-config.php
, which presumably doesn’t exist.
Update
The error message: failed to open stream: Permission denied
indicates that your webserver can’t read the /var/www/wp-config.php
file. It will at least need to read the file in order to open it.
I’d recommend asking your host to fix the permissions, or ask them how you can do it yourself. If you’re self-hosting on a *nix VPS or something similar, you’ll be looking for the chown
and/or chmod
commands.