Finding the path of a specific WordPress install - wordpress

I have recently taken over a WordPress website.
Once I got access to the server I found that there were more than 70 installations of WordPress spread across it (files and DBs).
What is the quickest/easiest way for me to determine which installation is the one that is running the actual live website?
I thought of putting a PHP file into each installation (a file that echoed something along the lines of $_SERVER['PHP_SELF'];) - then try and access that file from the site itself, from there I know which installation is the correct one (I can then work out which DB is the correct one from the wp-config).
But surely there is an easier way? I have access to wp-admin, is there anything I can do in there to show me the base install path of this particular WordPress?

Save the follwoing code into a php file and put it into the root foler. This will list all the folders which have the WordPress installation.
<?php
$dirs = array_filter(glob('*'), 'is_dir');
foreach($dirs as $dir)
{
$path=$dir.'/wp-config.php';
if(file_exists($path))
{
echo $dir.'<br>';
}
}

Related

What is the correct path to a file "below" the root?

I have a bitnami Wordpress installation. When navigating via FTP, the directory tree to Wordpress is home/bitnami/apps/wordpress/htdocs. When browsing, this acts as the root directory.
I have added several packages I need to use via Composer (AWS SDK, Facebook SDK, etc.) Composer installs these packages at home/bitnami/vendor. I can't seem to find the right path to these files.
I created a file called "test.php" in a subdirectory of the Wordpress root called test-dir (home/bitnami/apps/wordpress/htdocs/test-dir/test.php). I want to require the file home/bitnami/vendor/required.php in test.php. What would be the correct path to required.php? Here is my first guess (which throws an HTTP ERROR 500):
test.php:
<?php
require '../../../../vendor/required.php';
What is the correct path?
The simple solution was to use the absolute path:
<?php
require '/home/bitnami/vendor/required.php';

Wordpress: ERROR: "Table Prefix" must not be empty

So I'm trying to build a Wordpress website using AWS using RDS Aurora. I've installed the source code provided by wordpress.org and it uploaded successfully but after putting in all the information regarding the database it loads for a minute or two then says the page isn't working, when it reloads it gives me the error ERROR: "Table Prefix" must not be empty. I've tried many solutions but none of them are working
Check the URL of the installation page. It must have a .php suffix. If it doesn't, it's likely your .htaccess page is rewriting the URL and causing your POST requests to misdirect.
Edit .htaccess so it reads RewriteEngine Off.
This bug is often the result of inheriting .htaccess rules from higher directories.
In a fresh installation rename your wp-config-sample.php file with wp-config.php.
Then define you own table_prefix. Make it meaningfull related to your project. This table_prefix will be added as a the prefix of you tables in your database.
Example: $table_prefix = abcd_

Locating local directory for localhost

I've been spending hours trying to locate where localhost's files are stored.
I've tried looking at the page source but all it tells me is http:/localhost/....
which is not what I need.
My Xampp directory (where I load Xampp control) is located in my desktop but there is no change when I alter stuff inside its htdocs.
The default root for XAMPP, assuming you installed in the default location, is c:\xampp\htdocs. You can change this by modifying the Apache configuration in c:\xampp\apache\conf\httpd.conf.
You can always check it through PHP:
echo $_SERVER["DOCUMENT_ROOT"];
Or if you want to use WordPress functions:
echo get_stylesheet_directory();
Include these codes in your page.php or header.php for example.

Blank Page Encountered When Moved Wp-content Directory Outside

I'm trying to install Wordpress with clean subversion repositories, as in http://codex.wordpress.org/Installing_WordPress_With_Clean_Subversion_Repositories. I have followed every step accordingly until the second last step, where it says 'You should now be able to view the site via the root URL (http://example.com)', and indeed I can see my website on, say, http://example.com.
Once I go to the final step of changing the wp-config.php though, http://example.com draws a blank page. I am quite sure the wp-config.php is the problem, i.e. Wordpress doesn't know that it should retrieve my wp-content contents from outside the core Wordpress directory. My directory structure is as such:
.htaccess
core/
custom/
wp-config.php
, where core/ holds the files checked out with Subversion, custom/ holds my themes/ and plugins/ directory, and wp-config.php contains the below lines:
define('WP_CONTENT_DIR', dirname(__FILE__) . '/custom');
define('WP_CONTENT_URL', 'http://example.com/custom');
I have tried other variations, like:
define('WP_CONTENT_DIR', $_SERVER['DOCUMENT_ROOT'] . '/custom');
define('WP_CONTENT_URL', 'http://example.com/custom');
I have also tried hardcoding the local path, like:
define('WP_CONTENT_DIR', '/home/MYUSERNAME/example.com/custom');
define('WP_CONTENT_URL', 'http://example.com/custom');
, but none of the above works. Then I renamed the custom/ folder to wp-content/, but again nothing. I even went into Dreamhost to prevent redirecting http://example.com to http://www.example.com and vice versa, but again to no avail. I don't believe core/ is the problem, because I can access the Dashboard via http://example.com/core/wp-login.php, and the Dashboard says it can't detect my themes, which confirms my suspicion that WP doesn't know to retrieve the files from the custom/ folder.
By now, I have run out of ideas as to where could the problem be. Can anyone experienced in this area please give me some advice? Thanks a million.
Ensure that your statements come BEFORE the call for wp-settings.php, which is usually around line 90. Wp-settings (or more accurately default-constants.php) checks if the paths and URLs have already been defined, so you want to make sure you define them beforehand.
If that isn't the issue then check if $_SERVER['DOCUMENT_ROOT'] is returning the values you expect; you might have issues if working in a sub-directory.

Wordpress Blank Install Page

I uploaded a freshly downloaded copy of Wordpress 4.2.2 here: http://www.onedayonemillion.com/test/ and all I get is a blank page.
There are no .htaccess or wp-config.php files in the root directory.
No database has been connected yet.
I tried the same in another directory (/dev/) and it did the same.
I have no plugins installed or activated.
This is a fresh copy.
I added an phpinfo file here: http://www.onedayonemillion.com/test/info.php
Why can't I even get the install page to show up?
I didn't understand why there is no wp-config.php in the directory, it would be good you post what is in the directory. Anyway, you can check items like (sometimes it is just that):
some files with no ending "?>" ending the file;
any require_once methods calling non-existing files
(you said no, but) wp-config has wrong or non-set definitions (user, database)
check permissions/ownership to the folder
Well, I know it can be lame, but I had problem with definition in WPLANG define,
so I put an
echo "<br> there is no error until here";
through the files untill I find that was missing a comma at the definition. If the phrase is displayed, your installation files untill that point are working out.
Your phpinfo says the display_errors is off.
modify your php.ini with this line:
display_errors = on
you should restart the server after modification.
you can only track the error only if the error reporting is on in the server

Resources