Link to home
Start Free TrialLog in
Avatar of Tessando
TessandoFlag for United States of America

asked on

How to Use ".wp-config.php.swp" to Create wp-config file

I've got a client who's running Bitnami Wordpress using AWS Lightsail.

When I go to the page, it's completely white. I thought this was pretty unusual behavior so I did some Google-Fu and found a known permissions issues that has to do with Group and Ownership.

This requires adjusting the ownership of the wp-config.php file, a normal file that should be located at the root of Wordpress.

It's not.

Which is frustrating.

When I locate it using this command: locate wp-config.php

I find it in a swap file form: e.g. 2COMPANYNAME.com/.wp-config.php.swp

at

/opt/bitnami/apache2/var/cache/mod_pagespeed/v2/COMPANYNAME.com/http

How can I take that ".wp-config.php.swp" and move it to "~/apps/wordpress/htdocs", which is where index.php is for some reason and where I expected to find the "wp-config.php" file.

Thanks for your help.

Thom


...
Avatar of David Favor
David Favor
Flag of United States of America image

Ah mod_pagespeed. The source of many a problem.

If you have a .wp-config.php.swp this is an editor swap file which might or might not be useful.

This file is a binary version of your file in a format only the original editor program can understand.

You can attempt recovery of your wp-config.php file like this.

# cd to the exact directory where this file lives, as some editors dislike absolute paths during recovery
cd .../2COMPANYNAME.com

# edit the file using the exact editor used before (likely vi) + follow recovery instructions.
# Likely this will be typing R + ENTER
vi wp-config.php

# If you followed the recovery instructions + now see the actual file contents, exit the editor by typing...
:wq

# You'll now have a copy of your wp-config.php file in some state, which will be better than nothing

Open in new window


Note: It's super rare for vi to die, unless to OOM Killer kills it or the machine reboots while vi is running.

In either case, you should still be able to see your wp-config.php file in the correct location.

If this is true, then you will remove the .swp file completely, as saving it may destroy the wp-config.php file your site is currently using.
Avatar of Tessando

ASKER

Thanks David. I love that VI trick and I am able to open multiple config files on the Clients server with VI, so we're good there.

What I can't seem to do is find the dang thing.

What do the commas mean in the results of this locate statement?

/opt/bitnami/apache2/var/cache/mod_pagespeed/v2/COMPANYNAME.com/http,3A/,2COMPANYNAME..com/.wp-config.php.swp,

Open in new window


In other words, when I go to "/opt/bitnami/apache2/var/cache/mod_pagespeed/v2/COMPANYNAME.com/" I cannot get to http, even as "sudo". I just haven't encountered those commas before.

Thanks!
ASKER CERTIFIED SOLUTION
Avatar of David Favor
David Favor
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial