I've tried looking around for a guide on moving a wordpress site into a dev environment, but all of the guides I've seen have been about CREATING one, as opposed to my situation, where I need to move an existin site to a local VM to create a dev/testing environment.
I'm fairly well-versed on how to create a dev environment from a regular old website, but just about everything wordpress-related gets me confused somehow.
Where I am now:
I've created a CentOS 6.0 VM using VMware on a Windows 7 machine. I've installed PHP, Apache, MySQL, and FTP-Server, along with all of the required updates and such. I have disabled SELinux.
I've moved the contents of the var/www/html/ folder from the live (production) server over to the var/www/html/ folder on my VM (currently exists within /var/www/html/my-website/)
My current issue:
When I attempt to access localhost/my-website/ I'm getting "Error establishing a database connection". An attempt at localhost/my-website/wp-admin/ tells me that either the database server is down (do I have to start this separately?) or that the username and/or password information in wp-config.php is incorrect (this was all simply moved from one place to another).
Any assistance would be greatly appreciated.
Have you updated wp-config.php to include your localhost and database info for your local dev environment?
I bet wp-config.php is still pointing to your remote server DB which the MySQL DB wont allow for external connections
Also, make sure that the dev is using the same domain as the live version. On my windows machine, I do this by changing my hosts file. I'm sure there is something similar on your VM.
If I am unable to do this and I need the dev version to be under a different domain I would do the following.
Create mysqldump of live database
Edit the dump and replace
all occurrences of livedomain.com with devdomain.com (if you dont do
this at least check the wp_options table for the livedomain.com
occurences.
Change wp-config.php database settings.
I always ensure to use the same domain (controlled by local hosts file), and same db config in my dev environment as in my live environment.
If you've not changed the wp_options table for (option_name = siteurl or option_name = home), then chances are if you type in devdomain.com into your browser it will redirect to newdomain.com
Hope this helps
Blake
I know this was been answered but just to be perfectly clear:
on Centos6 you need to run httpd with php, and the mysql server. In the mysql server you have to import the database dump from the live website then you have to edit the config in wordpress to match the username and password on wordpress.
now when moved the db does not keep the username and password so I suggest you do this
commands to be run in shell:
service mysqld start
chkconfig mysqld on
that will take care of the db server running
then edit wp-config with username root and no password (I am pretty sure you have not added a password at mysql-server install)
post in here if you need further help.
Related
I migrated my wordpress website into my local machine, but it's redirecting me to the original ,-server one-, website, immediately after I opennig the local one.
I try to describe what did I do as detailed as much I can:
First I got all wp files and copied-d it to my local XAMPP htdocs directory via SHH (FROM Linux Debian 10 - Apache 2 Webserver).
After that I exported the database (exported to sql file format).
I created the same database and user (with the same permissions as the server db user) in the local webserver
Everything went successfully, but after i want to open http://localhost/ I got redirected to my old site like https://originalsite.com
What did I tried to solve the problem:
I checked Apache, PHP and phpmyadmin version, but these are the same.
I reinstalled XAMPP but that also didn't solve the problem.
I checked wp-config.php but there aren't any options I've could been change, php.ini and my.ini both of them not gave me any alternative.
Thanks!
In the .sql file you imported, find "site_url" and change it to localhost URL. Or you can define it in wp-config.php file as "WP_SITEURL"
You will need to manually go in Database and Replace LIVE site URL with the Local URL.
Something like:
https://originalsite.com/
TO
http://localhost/originalsite
I want to share my local wordpress site with another developer with git in a way our database will be same when he setups my wordpress site in his local PC.
I am using windows 7 OS
I'm not sure if what you are asking for is possible.
here is my suggestion (the database should be on a real server)
if you use CPanel:
1- In the CPanel create the database and new user and assign the user to the database
2- In the CPanel Go to Remote MySQL, add your IP address and the other developer IP address. (to allow remote access)
3- Export the database from your local PC and import it to the CPanel.
4- Change the wp-config.php configuration.
Note: The urls should be the same on your PC and the developer pc.
for example if your website url on your pc is : http://localhost/mywebsite/
the other developer should make it the same.
I would suggest keeping your database out of git (except perhaps the database definitions).
Instead you can leverage git hooks. Using something like pre-push, run a mysql dump command to get the current state of your db, and copy it to a shared Dropbox/Drive folder with your team mate.
.git/hooks/pre-push
#!/bin/bash
mysqldump -u root -p --all-databases > ~/Dropbox/shared-with-tm/mysql.sql
Completely untested This is a vague answer to answer a vague question - but might give you a starting point.
I'm new to Drupal. I want to run my Drupal website locally and connect directly to the remote database, but I can't seem to figure out how to do it. I have MAMP installed on the Mac and I have all the files in the htdocs folder. It looks like I just need to change the settings.php file to match my remote database, but I'm unsure what I need to change.
I guest you look at this drupal.org HowTo that step by step guides you through creating the database and what you need to change before running the Install program.
https://www.drupal.org/node/66187
Also check the comments on that thread.
Yes, you have to adjust your settings file (/sites/default.settings.php), database configuration. Watch out, usually there is a different ("external") host for accessing database from out of server. I think that it can be set per database user does it has privileges to access database from outer server or not. Maybe there's some special user for that.
There should not be any extra setup or configuration. Just make sure that
You are connected to the remote database (usually goes in sites/default/settings.php).
The database host allows remote connections.
I am trying to introduce a staging step in my company's code-production process. We currently have ~10 eng clients who commit code individually, update local codebase - debug/check locally, then we deploy the code to production environment and have other employees QA. Obviously we would like to have a better pre-production test process to help catch bugs before they go live to the public.
My first attempt is to create a staging environment on an extra ubuntu box with the most recent committed code from the eng clients. I then could allow the Product Managers to check this site and find bugs, test features, expose bottlenecks, etc.
What I have: The ubuntu machine (local server) is currently configured as a normal eng client. It has a local drupal installation, complete backup of the db, and all of this is accessible locally. Let's go with mysite.com = official site; and the local staging domain I use on the ubuntu box = ms.com. This local ms.com works just fine, so in essence, I need to just allow other people at the company to navigate to some URL and it acts the exact way ms.com currently behaves. I have DNS servers pointing to the ubuntu box and it is running some side projects out of the /www folder.
In an effort to keep the side projects running, I think my solution is to create a name-based virtual host that points to the directory of the local drupal installation. Is this the right thing to do to achieve my goals? Is there an easier way to open up this local config to the employees.
In trying to set up the virtual host I did the following:
I added the static ip address of the local server to /etc/hosts
I added a virutalHost to /etc/apache2/sites-available with the DocumentRoot dir/DrupalInstallation
I added a2ensite
Then restarted apache.
Halfway success. I can get to the main page, but none of the modules load, I tried loading more hosts/variations, started changing all localhost references to the external, but I don't really know what the underlying issue is and I do not know how to diagnose it. The one interesting bit is that if you click on some of the links, it kicks you back out to the index page of the www folder - I don't think the site alias is 100% sticking for requests.
Let me know if there is any sort of log or report I can share to help diagnose/debug this. Any and all help greatly appreciated - thanks!
It sounds like your specific error accessing pages beyond the homepage is related to not having mod_rewrite enabled/configured.
A different approach:
On a bigger scale, it sounds to me like you might not have what it takes to administer the staging server when something goes wrong. If you're unskilled at linux server admin, save yourself the headache and use a preconfigured virtual appliance (e.g. Quickstart, AegirDev, or Walid) instead of the dedicated box. If your staging box isn't beefy enough to handle hosting virtual machines, then just run the QuickStart install scripts over a base uBuntu build.
Now that you know your staging server is working and runs imported Drupal sites successfully, install git, create a shared repo, and make sure you and your developers are setup to use git as their source control in their IDE.
What i want to do:
Develop a Wordpress-based website with a local Wordpress installation (and xampp).
Migrate this developed website on my webserver.
What's the problem:
After putting the website on the webserver each link in the navigation references to "127.0.0.1/wordpress/...".
I'm not even able to login to the Wordpress Backend on the webserver, because the "login.php" (or something) is also referenced on the localhost"
My Question:
Do any of you know how I can change this permalinks to the URL of the webserver the website is actually deployed on?
best regards
matt
edit:
Another thing that i noticed is, that although I changed the URL in the wp_posts table manually, this database entries are changed by wordpress, so next time, after opening the website, the URLs in the database contains the 127.0.0.1 part
When migrating the database from your local machine to a remote server, you should export your mysql database that is on your local machine to a file. Then perform a search and replace changing "127.0.0.1/wordpress/..." to "www.yourdomain.com/path/to/wordpress" and then import that file to your new mysql database.
Since you have already moved everything over, you can just export the database tables from your remote server to a file, do the search and replace on that, and reimport it. When exporting the database make sure to check "Add Drop Table / Drop View".
It's very simple, do everything you need in local, when you're ready to deploy, export your local database from phpMyAdmin, open the file and do "search and replace" your local path with your server path.
Chnage the connection string inside config.php and you're done.