Share my local wordpress site with another developer with git - wordpress

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.

Related

How to copy file structure from wordpress website to new host

I'm having troubles moving my current website to a new host. The website is hosted on a www.website.org/wordpress and I need to move the entire website to a new server to which I have access via ssh and ftp.
The plan is the usual, backup all files and the database and then move the files to the new server, where the website will be hosted in a new address. But the tutorials that I've found use cPanel or other management tools that I don't think that I have access to.
The other method is to try and copy every file from my current webhost using ftp, but I don't know how to connect to the website and copy all files.
Somehow I'm having problems downloading the files from my website to my computer to move them to the new server.
Is there a simple step that I'm missing on how to log into the website to copy the file structure from wordpress?
Thanks in advance for any responses.
Through ssh you should try the scp command.
You can read more in this explicative answer How to copy a folder from remote to local using scp?.
EDIT
In your case would be:
scp -r user#sourcewebsite.com:/path/to/wp user#destinationwebsite.com:/home/user/Desktop/
Let's check that source and destination folder paths actually exist.

Local Drupal website connecting to a remote database

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.

How to access local WordPress installs from other machines on my network

I have XAMPP running fine on one machine and I have 2 WordPress installs running fine on that machine. I would like to be able to access and work on those WordPress installs on other machines on my network.
Right now, I have it set so that if I try to access those directories from another computer on the network, all I get is either the XAMPP splash screen, or a 404 error if I try to access specific folders.
I've researched this and researched this and I have found numerous posts about how to do this.... but only in bits and pieces.
Does anyone know of a step by step, start to finish, guide of how to do this? In layman's terms?
Remote (from another network) would be great too. But I'll cross that bridge once I figure this out.
Any help would be appreciated.
Thanks!
I would suggest rather than shared folders you use an FTP client / server - I use Filezilla server and client for my local sandbox testing server. This will give you additional info like file and folder groups and permissions.
Got to ask the question what OS? have you opened port 80 on the server machine?
Things like this can also occur on Linux if the folders and files do not have the correct groups for access and or permissions.
chown -R apache:apache /var/www/html
the above if on linux will assign all the folders and files to be accessed by the apache process. not having the correct groups assigned can give you 404 when you know the files are actually there.
also check the file and folder permissions,
different files and directories have permissions that specify who and what can read, write, modify and access them - this wordpress page gives a good overview of permissions
http://codex.wordpress.org/Changing_File_Permissions
edit p.s. to access then from other networks all you will have to do is forward ports from your router to your internal server then your ftp and www services will be accessable from the outside world. I would suggest using a .htpass htaccess password to protect your services at this point.

Making local Drupal installation accessible through Virtual Host

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.

Wordpress Dev Environment Migration

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.

Resources