Restoring WordPress site only from htdocs's webstie folder - wordpress

I had a wordpress site hosted on localhost using xampp.
Due to unexpected problems only what I've got from my old XAMPP files is htdocs's folder of mentioned site. Is there a way to restore the old website only from this file only?

WordPress content is stored in the database. If you don't have your MySQL database exported (.sql file extension) from phpMyAdmin (web) or mysqldump (CLI), you'll have files without content, and likely a lot of PHP errors. The database also has the configuration for which theme to use, which plug-in(s) to enable, your Dashboard login (and users), etc.
If you have command line access to your MySQL database, you can use the following command to get a copy of your database:
mysqldump --add-drop-table -u USERNAME -p DBNAME > DBNAME.sql
This assumes the hostname is "localhost", but you can specify the hostname with -h HOSTNAME.
--add-drop-table is not required, but helpful if you're wanting to start clean with a database import. Keep in mind that it will delete the table in its entirety, so if you've already got a live site using the same database and table prefix, you're wiping out that live site.
-p will prompt you for the password once connected to the MySQL server. If successful, there won't be any output as the database is exported into the filename you provided.
You can name the output file anything you want, but it's a good idea to keep it the same name of your database, or even SITE_database.sql (i.e.: mysite.com_database.sql).
However, if you have the export of your MySQL database, you can import it with the following command:
mysql -u USER -p DBNAME < DBNAME.sql
Similarly, you'll be prompted for the password, and if no errors on the command prompt, the import should have been successful. With your site content and MySQL database restored, your site should appear as it was, content and all.

Related

Couldn't setup an existing drupal site on local server

imported database, copied drupal site files to wamp/www folder, changed database configuration files, but got "Drupal already installed" error.
Tried by increasing packet size on mysql configuration file.While trying with an empty database , through the setup steps, site being installed. Is there any solution to use the existing database
Drupal version:8.9.20
Php: 7.4.26
apache: 2.4.51
mysql:5.7.36
This message can happen for several different reasons, so here is a start to help you trouble shoot:
MySQL max_allowed_packet, innodb_buffer_pool_size, innodb_lock_wait_timeout
Adding this to verify that this is the packet setting you updated in my.ini
Try updating the innodb_buffer_pool_size & innodb_lock_wait_timeout settings as well
Be sure to restart MySQL after the update is made
drupal.org source
Verify Permissions settings.local.php & MySQL DB user
Make sure the file permissions on your /sites/default/ folder is correct, and settings.local.php file (or whichever settings file you are using)
Make sure the DB user you have configured in the settings file has the correct permissions to the DB as well
Check log files
Check all log files in your WAMP log folder to see if there is any additional information

How to setup wordpress to use ftps with pem file?

On AWS Lightsail/EC2, there is a WordPress instance that is unable to upload images/templates/plugins from within WordPress.
I have been able to FTP into this instance with Filezilla and also ssh with bash. But the upload functionality inside WordPress needs to work.
When trying to install a new theme from within WordPress, it asks for ftps credentials. AWS requires the use of a pem file. The WordPress ui does not have the option of using a pem file.
The solution seems to be something like this, but I don't know the actual commands and steps: SSH in, create a user, give them access to something, create a new pem file, and tell WordPress to use the pem file via the FTP section in the wpconfig file.
The file structure is ~/htdocs/{wordpressFiles}
It sounds like you created the folder via FTP thus the FTP User is the file owner, so Apache cannot access it.
1.) Check if the main user is daemon or bitnami with ls -l
2.) If the user is not daemon you can try sudo chown daemon:daemon path/to/wp-plugins

Issue with connection FTP wordpress on appengine

I am starting with Appengine on GCP and recently had installed Wordpress. But when i tried to install plugins o some themes, i see a window:
Connection Information To perform the requested action, WordPress
needs to access your web server. Please enter your FTP credentials to
proceed. If you do not remember your credentials, you should contact
your web host.
I saw the post with the same issue and I add to the file php.ini:
google_app_engine.disable_readonly_filesystem = 1
and tried to deploy the app again, but doesn't work.
Does someone have wordpress on Appengine in Standard environment running without troubles ?
Best approach is to run Wordpress locally and then deploy to appengine. After lot of trials and failures, I have made these notes for my own reference, and hope these help you too. Here you can run the wordpress site on a separate service on appengine and have multiple services to run different wordpress sites. This way you need only one instance of CloudSQL which is cost effective
On GAE:
Your project ID (myGcpProjectID).
Create SQL Instance if not already exists (instance name: projectwideSQLInstance)
Do not have to create a new instance for wordpress, unless you need security and
don’t mind increased cost.
Create database (name: wordpressDatabase)
Create user and assign a pwd (user: wordpressDBUser ; user: wordpressDBUserPassword)
On your local machine:
Install Composer from https://getcomposer.org/
Run following commands in CloudShell SDK inside your work folder
composer require google/cloud-tools
vendor\bin\wp-gae create
**Answer the series of questions **
Region of SQL instance to be same as from GAE
dir: wordpressforgae (or any other name, this is just your local folder)
project_id: myGcpProjectID
sql_instance: projectwideSQLInstance
db_name: wordpressDatabase
db_user: wordpressDBUser
db_pwd: wordpressDBUserPassword
same user for local? Y
All required wordpress files will be downloaded into the folder wordpressforgae.
Open MySQL Workbench and create a schema with name wordpressDatabase (same as db_name above) on your local server
Download latest version of wordpress and extract contents to a folder named localwp
Install XAMPP (Only Apache server and PHP, Deselect all other options).
Delete the contents inside the htdocs inside XAMPP folder and Copy the contents from localwp (extracted from downloaded Wordpress.zip file).
Run wordpress using a browser with localhost in address line. It will ask you for database details. Answer as below: (Make sure these values match with what you added to CloudSQL instance in the beginning)
Server: yourlocalhost
Database name: wordpressDatabase
User: wordpressDBUser
Password: wordpressDBUserPassword
Necessary fields are added to the database and it will ask you to Enter site details along with site admin name and pwd. Enter site details here. Once everything is done and site is created, check the same by opening “localhost” in another browser, which should show a basic WP website with your site title etc. Now close both browsers.
Now delete the contents of htdocs folder inside xampp
Copy the contents from folder "wordpressforgae" (downloaded with command wp-gae create) and paste inside the htdocs folder of xampp.
Check wp-config.php to ensure these
if ($onGae) {
/** The name of the Cloud SQL database for WordPress */
define('DB_NAME', wordpressDatabase);
/** Production login info */
define('DB_HOST', ':/cloudsql/ myGcpProjectID:project_region:projectwideSQLInstance');
define('DB_USER', wordpressDBUser);
define('DB_PASSWORD', wordpressDBUserPassword);
} else {
/** The name of the local database for WordPress */
define('DB_NAME', wordpressDatabase);
/** Local environment MySQL login info */
define('DB_HOST', 'localhost');
define('DB_USER', wordpressDBUser);
define('DB_PASSWORD', wordpressDBUserPassword);
}
Now open the wordpress admin in browser with address localhost/wp-admin. Make all changes including adding/removing themes, uploading images, creating pages or anything else. Check website on another browser as you are making changes.
Uploading site to GAE:
First time, use this command to upload
gcloud app deploy app.yaml cron.yaml
If you like to create the website on a different service than default inside your Appengine add this line to app.yaml
runtime: php72
service: wordpress (can be a different name for each site)
For any subsequent minor changes made to site locally, same can be reflected on GAE by simply exporting the database from local to GAE Cloudinstance using MySQL Workbench.
Only If major changes are made to design, like new theme, add images from local machine etc deploy to GAE using
gcloud app deploy app.yaml cron.yaml
It is better to clear the bucket using this before each deploy (Make sure you have enabled delete rights using IAM - Add Role "Storage Admin" for the email ID you are using on CloudShell login to your GCP account)
gsutil -m rm gs://staging.myGcpProjectID.appspot.com/**
If you have different domains/subdomains you want to direct to each of these sites, you may do the same by adding domains to your appengine and configure dispatch.yaml file to redirect each domain/subdomain to corresponding service on appengine

Running wordpress site different local host

I have recently taken my first programming project and it is with word press, I have never used it before as I have only done hard coding HTML/CSS before. My client has given me all of the files of her site, how do I run this on wordpress. I have installed wordpress and can run the test123 site but when I do the same thing on the local server with the info she gave me then I get a "Error establishing a database connection". This is surprising because all of the file folders in the info she gave me is the same as the test site (obv the content is different). She was doing it on a mac and I am on windows but I assume that hsouldn't matter. How can I fix this so I can see the site on wordpress and make the required changes that she wanted.
Thanks!
I tried changing the config file but that just gives me the setup again and not the site she has already made :(
First, create a folder into your htdocs folder with name test123
now put all the directory which one provide you by client in to test123 folder like wp-admin , wp-content ....etc
after then in new tab run this path
http://localhost/phpmyadmin/
Create a database with name something test , then import the database which one provide to you by your client , after import go to table name wp-options and change the site url http://localhost/test123 same for admin URL
Now back to your files and open wp-config.php file from your test123 folder root directory , change database name which one you recently created "test"
username set to "root" and password "blank" hostname should be "localhost"
now run path in to URL http://localhost/test123
after this if you want to login http://localhost/test123/wp-admin
then first you need to change user password with md5 strings from database wp-user table
the site will work on localhost
Here some change for wordpress project on host to other host .
in your sql file change host name example
to change
http://localhost
after change to your config file details.
installation WordPress in wamp server
first, start wamp server
click to start all services when it will work the icon will be colored green
Go to C:\wamp\www and paste WordPress folder there. You can rename the WordPress folder to anything you want for example test123
Now open a web browser and go to:
http://localhost/test123/
it will ask you for database connection error
now open the phpmyadmin as showing into create
a database and import the database
then go to you Wordpress folder test123 and find the wp-config.php file and replace your username with "root" database name you created , and password blank . now run http://localhost/test123/ once again
if not work then please come to chat box room.

Google App Engine local WordPress install error with MAMP

I'm trying to set-up WordPress to run on Google App Engine.
I'm following the docs over here with MAMP as my local dev environment. The app runs okay through the GAE Launcher, but when I browse the localhost:PORT, I get:
Error establishing a database connection
I've tried changing the define('DB_HOST','localhost'); value to localhost:3306 (my MAMP MySQL port), 127.0.0.1, and even the socket address (:/Applications/MAMP/tmp/mysql/mysql.sock) - but I can't get past the database connection error.
I'm wondering if I have misinterpreted the instructions. I originally thought that the database name, username and password were just placeholders that one was supposed to customize, both in Step 3 (create database and user) and 4 (edit config file). But, hoping I could run it remotely on App Engine, I looked at their sample SQL they use to set up the database and they're using the generic terms (wp_user, wp_password) in their SQL stored in Cloud Storage. Does anyone know what is the correct procedure?
I'm seriously stuck. Can someone help?
Try the following:
Remove the ** from DB_NAME, DB_USER and DB_PASSWORD, i.e. use:
define('DB_NAME', 'wordpress_db');
/** MySQL database username */
define('DB_USER', 'wp_user');
/** MySQL database password */
define('DB_PASSWORD', 'wp_password');
When you create your user in MySQL, make sure you use the #localhost terminology as shown.
If all else fails, start with WordPress 3.5.1.
I found a better way of creating a database by following this video by Google Developers.
If you use MAMP, go to terminal and type
/Applications/MAMP/Library/bin/mysql --host=ipaddressOfCloudSQL -uroot -ppassword
Once you login, you can follow the rest of the instructions as follows.
I don't know if you still have this issue, but this is an issue of where the app SDK is looking for the file MYSQL sockets file (mysql.sock). I'm not sure where whether you can configure this somehow, but this worked for me since the default folder that the SDK looks for the file is /tmp:
cd /tmp
ln -s /Applications/MAMP/tmp/mysql/mysql.sock mysql.sock
If you simply link the MAMP sockets files to the one that google's app engine expects locally, it works. :)

Resources