Local By Flywheel - Error establishing a database connection - wordpress

I was working on a website for a client a week ago and I came back to make further edits, but whenever I want to access the website, it reads:
Error establishing a database connection
I checked my wp-config file and everything is untouched; I did not touch one single line of code here when setting up my new Wordpress project in Local by Flywheel.
All my other local websites work except for this one. I've provided an image of my workspace just to make it more clear.
Looking at this image, the MySQL Version is a little bit off. The version should in fact be 5.6.37, but instead it's reading an older version of MySQL.
I did try closing and reopening Local by Flywheel, but it had no effect.
Any help appreciated. Thank you!

Right click on the site name and click on “Reveal in Finder” in Local by Flywheel.
Compress the folder containing all your site in a *.ZIP file (normally there must be at least the “app” and “logs” folder, sometimes “conf”).
In Local by Flywheel, import the site manually in FILE / IMPORT SITE, choose the Zip of your site
Normally, it reinstalls the site and recreates the Database … for me it’s work (on Windows and on Mac)

Are you able to compare your wp-config.php file in the broken site to a site that is using the same MySQL server?
I know you said that the file is untouched, but check again that all of the define parameters are correct.
Next I would suggest logging into your MySQL server using the credentials you have listed in the wp-config.php file and ensure you are able to access your database.

Related

Wordpress encoding issue after migrating to new server

We've switched server for one of my client's website from a CentOS CPanel to a other CentOS CPanel We encountered some irregularities with accents and single quote.
For some reason, some characters are displaying as it should and some are not :
wrong encoding on different sentences
I've tried to change DB_CHARSET to utf8 and I've also tried to change table collation without success.
Website was running great on former server. Everything is wrong since we've changed it.
One of the users has issues connecting to the site as his user group switch every now and then. I don't know if it could be related ?
Any help would be very appreciated.
Try this to Fix Character Problem in WordPress:
As you know that latest Wordpress defined DB_CHARSET and DB_COLLATE values in wp-config.php. Which is actually the main reason behind this issue. To fix this issue just comment those two lines in wp-config.php file.
Open wp-config.php file and locate below lines
define(‘DB_CHARSET’, ‘utf8’);
define(‘DB_COLLATE’, ”);
Comment them out and Save that file. After commenting it should look like
//define('DB_CHARSET', 'utf8');
//define('DB_COLLATE', '');
Now upload the updated ‘wp-config.php’ file to your WebHost (overwriting the old one).
This character encoding problem can happen after a database upgrade too so it doesn’t hurt to keep this trick in your mind just in case.
You may experience an error when importing a WordPress .sql database from your old hosting to new.
So, Try again Export a .sql the database file manually via phpMyAdmin on your old host, then import the .sql to your new database. Try bellow steps;
Open phpMyAdmin & select your database
Click the "Export" tab for the database
Click the the "Custom" radio button - In the section titled "Format-specific options:", change the option for the "Database system or older MySQL server to maximize output compatibility with" from 'NONE' to 'MYSQL40'.
Scroll to the bottom and click "GO".
Now you should be able to import your .sql into phpMyAdmin in your control panel.
FYI, I've found the issue. It was server related.
I've checked the list of PHP extensions that were installed on my server and some were missing...
I don't have the exact list as there was a lot of them missing.
So, for those who have same issues, check your PHP version and extensions.

Cant Upload, Update, Install Plugins After cloning wordpress with backupbuddy

I've just migrated a client site to her production server using the latest version of BackupBuddy v3.0.40, and at first glance everything looks dandy, but on closer inspection, most WP file functions are borked: update wp, upload images, upload plugin.
I've done this a ton of times (several times on this host), and don't know why its not working here
I suspect it has to do with the tmp directory, but i can't see a problem..
another possibility is that a script (installatron via cpanel maybe interfering.. i notice that there are upload folders created for all months up to 2016! i read about this being a solution to permissions issues in WP's past)
This is what I've tried:
changing the wp-media upload location to the default, changing the 'store in year/month' setting and general wiggling. this was imported as '/home/###/public_html/wp-content/uploads' which looks correct, but unnecessary, the default is wp-content/uploads. neither work.
changing the permissions on wp-content and uploads dir to 777 (not all contents)
adding a line to wp-config.php:
define('WP_TEMP_DIR', ABSPATH . 'wp-content/'); no dice
uninstalled all traces of the installatron scripted wp installation (no files or db remain)
repeating the migration (same backup file, identical results)
confirming that:
i can create new posts, just not upload media
it works on the staging server (same host)
safe mode is off
apache is running as user, tx suPHP
the files were extracted by php via the browser
i've compared phpinfo to other working sites and dont notice anything out of the ordinary
hope you can shed some light!
thanks, Tim
image upload error:
“envelope-9887.jpg” has failed to upload due to an error
The uploaded file could not be moved to /home/###/public_html/wp-content/uploads/2012/07.
wordpress update error:
Download failed.: Destination directory for file streaming does not exist or is not writable.
plugin install error:
Download failed. Destination directory for file streaming does not exist or is not writable
sometimes when migrating you may have to look through the database options table and change a few entires, ie:
from the old site structure it could be: /home/yoursiteid/public_html/wp-content/ etc..
but on the new server the structure could have changed?
ie: /home/differentuserid/wwwroot/wp-content/
edit a file on the server to include :
echo getcwd() . "\n";
just to see if the home directory is the same as your current server or if its changed from your old sevrer, have a check in your database options table and update the entires which ref the old dir structure..
I found, eventually, that I'd overlook the line
define('WP_TEMP_DIR', 'old-hard-link-here');
which I believe was nestled directly under the wp salts, camoflaged to the tired eye! Simply removing that line and setting the media path to the default fixed the issue.
I believe that that line was installed by the cPanel script 'Installatron'.
Case closed

Creating a MAMP Local Copy of a Drupal 6 Website

We're currently rebranding a client of ours and it's come the time to take the new brand to their website.
I've not much experience with Drupal other than the theming (I've themed a Drupal website in the past but not very familiar with the software's inner workings).
As this website is live, it's obviously not feasible for me to make any changes to the live environment, so I have downloaded the source files of the website to a local webserver (MAMP).
I also have a MySQL dump of the database.
I'm not sure what files need to be changed inside Drupal to allow access to the MAMP webserver. Could somebody point me in the right direction here?
How would I connect the database to the website, which files need modification?
I think the client is running Drupal 6.
Update:
I've installed the database and linked it up using the below line:
$db_url = 'mysql://root#localhost/databasename';
I've hidden databasename for anonymity.
As it's MAMP, the database has no password. When I load up the website I get an error that install.php is not found. It's not there because the website is already 'installed'.
I've also updated the $base_url to read:
$base_url = 'http://localhost:8888/foldername';
You only need to modify one file, 'sites/default/settings.php'; you'll just need to change the database connection string in there to match your new database settings. There may be a couple of other settings in there you need to tweak depending on the set up of the site (for example the $base_url or $cookie_domain).
Other than that everything in your installation should be relatively path-ed so there shouldn't be any need to make more changes.
i was facing same problem after couple of hours try i got solution : we have to check the DB (tick on list of databases in local host) [ observe this after DB list : Enabling the database statistics here might cause heavy traffic between the web server and the MySQL server. so enable only the db you want to use] this will redirect to http://localhost:8888/foldername/install.php successfully :D :D

Where does WebMatrix save the site configuration?

I have a website saved in Dropbox folder and I successfully worked on it for days without any problems with publishing. When I opened that site today in WebMatrix on another computer, I had to configure publishing settings again off course. I did that and tried to publish the site with only one file modified, but I was surprised when I saw all files in the publish dialog marked for upload.
One thing came to my mind - to copy site configuration from first to second computer so that second computer has information about already uploaded files and continues to publish just the modified ones, but I don't know if the site configuration is stored in file or registry or something else...
So, before I start digging I decided to ask the wise ones here :)
I found it in following location:
C:\Users\Username\Documents\IISExpress\config\PublishUI
When you try to make a new publish setting there is a link where you can say you want to import old settings. This looks for files with an extension called .PublishSettings or .XML, so I would start by searching your pc for files with that extension. I would imagine the .xml file would have your sites name in it's filename, so that is worth a shot as well :)
This should be enough. If not I am looking forward to hearing what others say or you can dig up yourself.

Asp.Net, upload picture with VS2008 local web server

Users of my web site will be able to upload a picture. This picture will land in /images/folder/picture.jpg. The question I have is: When running under VS2008, a form will insert a full row in a database column (sql server)and the picture will be uploaded to the folder. The result page will show the image. But when running the web server again later, the database will be ok but the image won't be there anymore since I guess that the local server each timer starts freshly with no content in the folder. I am new to uploading so I am wondering how you do to test this kind of thing.
Also, must the folder for the images be under /Content ? I am not sure where to put it and how it will transition when running under IIS ?
Thx
The ASP.NET development server does not clear the directory each time it starts. Have you verified the files are actually being written where you think they are? Seems like you've probably got some path issues and the files are possibly being written to the ASP.NET Temporary Files folder which may change from instance to instance.
I've have to test this with my local server to see exactly what it's doing with regard to the image that's being uploaded locally... but one thought is that instead of storing the picture on the file system, store it in the database itself.

Resources