Need cheap source control [closed] - php

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
My friend and I accepted simple PHP job, he has some experience working with a small team of developers and I'm new to this (and PHP to be honest :).
When I asked him about his environment I found out they (he and his previous team) never used source control, just a shared FTP server with a lot of mess. Now beginning this project I want to do it properly and use source control, I did some research and it looks like SVN is the simplest to use and fits our simple requirements.
My problem is that I don't really have an extra box to create a server... I have two options, one is to use my main windows machine as a server (it's always on so that's not a problem) BUT I can't always guarantee that it will be on when I'm far from home and I don't like how it will waste CPU cycles (It's also my gaming rig), the other option is to use an old laptop I have lying around (a Pentium 3 with about 128-256MB of RAM) and install the slimmest version of linux on it and the SVN server. it has the advantage of being simple, cheap and easy to maintain, but it has the disadvantage of being alow performing old laptop and having some uncertainty about it's reliability (I guess I'll set up some backup to my main machine).
Which option is better? I would prefer using the laptop but I'm unsure if its specs will slow us down, if I do use it, what version of linux would you recommend, and how simple is it to add some regular backup to it (I have almost no linux experience but I'm glad to learn).
PS. forgot to mention, both of us developing on windows machines.
EDIT: Most of you recommend Git and Mercurial, I think I'll go with mercurial because I read that git is more complicated, I really want the simplest solution that I can find. Unless git has some major advantage over mercurial? or maybe mercurial is the better one for the job?

Look at distributed version control systems like git and Mercurial (hg). Both have free/cheap hosting services (e.g., http://www.github.com and http://www.bitbucket.org) and are well suited for multiple developers working independently.
Also both have good tooling on Windows.

Why not use bitbucket/mercurial (hg)? You can set up (apparently) free private depots. Mercurial is crazy easy to use and is a lot newer (and rapidly gaining popularity) than svn.

Use git. It was designed and written by the guy who started Linux and he knows what he's doing.
You don't need a server for git, each user has a copy of the whole repository and you sync to each other. There is a bit of a learning curve, but if you're smart it will make you better developers.

DVCS like git is cool because you do not even need server. You basically just "synchronise" your code between each other here and there and due to fact that each repository has data from all repositories once is "synchronised" you do not need extra backup or server in most cases.
I found nice feature whit git (probably whit other VCS-s too) is that since they are just file based you can use any (free) cloud storage / ftp / git_server to backup your files in case of cataclysmic catastrophe.

I would highly recommend Mercurial (hg) as mentioned above, simple, easy to use and distributed. Personally, I prefer it slightly to Git and secondly its Windows support is better.
Bitbucket also lets you have free private repositories whereas Github is only free for public repos. Which I am guessing will be a factor if you are producing commercial code.

Why not go another route and get GitHub.com (pretty cheap, but costs a little) or BitBucket.com (this one is free for up to 5 users and unlimited repositories). You'll avoid a lot of headaches from maintaining your own servers.

If you want to host it yourself, check out subversion edge. Its a packaged svn that comes with apache and some management tools.
If you dont want to deal with admin stuff, check out beanstalk. They do hosted SVN.
Or, you could use something like git and github; but if you're really set on svn, check out beanstalk

Related

How to manage my project? (Souce code control, production server/developing sever) [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
i'm in a small team right now. We have two developers. We are developing PHP web applications. Now we have two servers. One is production server, the other is developing server. Usually my work-mate and I worked for different part of the project, but sometimes, we changed the same file. There was a source code version problem. As we are very small team, is there any light-weight version control strategy for us? We use different developing tools. I use VIM and my work-mate use Dreamweaver. Is there any source code control system support those editors?
Another question is how to control the synchronization between develop server and production server? Now what we do is just use ftp upload the files that we just tested on the
you have github(maybe by private account, because github is just amazing!) in your tag so I should suggest to just learn git(Command-line). It is the best in my opinion. One of the nice features of git is that it is distributed. I also bet if you search hard you could find plugins for both editors(like I did quickly):
git for vim.
git for dreamweaver.
But I would just use cli instead because it's power is just amazing.
As far as version control goes, Subversion is a popular choice, and easy to set up in my opinion. Looks like it can be integrated with Dreamweaver beginning with CS4, as well as VIM (although I don't have any direct experience with either of those plugins). Even without direct integration it's easy to use from the command line. I'm a big fan of RTFMing before digging into anything new, so the fact that the O'Reilly Subversion book is available as a free PDF on their website was a big plus for me.
For coordinating the move from development to production, my personal advice would be to automate as much as you possibly can - I've seen cases in which the migration is handled by a human with a checklist, and human error always seems to creep in eventually. If you're most comfortable with PHP, and you primarily access your servers via FTP, you could use PHP's FTP functions to automate moving the tested code from the development server to production.
Scenario : you can install subversion on production and developer server
Use svn and i suggest you add messages like +) for added stuff, -) for removed if that happen, o) for fixed bugs. This will help you latter.
Do commits as offen as you can
If you are not familiar with Tags and branches in SVN, just do the list of files that you are going to update on live server.
go to Live update.
Scenaria : you can't install subversion on production server
create a separate "live enviroment" on developer server
update it, when you see all works use any kind of FTP, SFTP to copy it to live server
Good luck
For version control almost any modern open source version control software will do,
For starters there is Subversion, mercurial, bazar, git. If you've never used one before I would recommend giving them all at least a quick look over to see what you like. My preference is git but the rest are all easy to use (ish). Most have companies that provide version control as a service (so you don't have to gaff with managing software yourself)such as github, launchpad, etc.
All have their benefits and downsides depending on your working style and project.

Making php development more robust

I've spent some time now developing a web application in php. It has mostly been just for the fun of learning as a side project, but the app now has a few users which I don't want to upset by breaking things as I develop.
At the moment, I have a very rudimentary method for managing the development - I use a text editor (ultraedit) to write the code and use its built in ftp to upload the files to the server. In terms of version control I have 2 domains, and only push files to the "live" domain when they work, but that's it. The domains are hosted on a cPanel shared hosting site which I have some doubts about its ability to handle even minor spikes in traffic. I looked at slicehost yesterday for something more scalable but that looks like a bit of a learning curve from where I am now.
I know I could do better than this, but where to start? I think I need advice on three things
1 - code writing tool
2 - version control / management
3 - scalable hosting
I've deliberately asked these in the same question as I'd like to know if one choice impacts another. Is there a good integrated solution?
Thanks in advance as ever.
Each part of your question has been answered before. The list below lists some of the common tools to use and links to appropriate searches on StackOverflow. There is no all in one package and going into details about these tools in one question is out of scope, so I am afraid you have to do some digging:
SVN, Git or Mercurial
UnitTesting (PHPUnit or SimpleTest)
Continuous Integration
Phing (for deployment)
phpqatools.org
Netbeans or Eclipse (for an IDE)
Disclaimer: list is not meant to be complete and order is not important
There is a lot going on here. I'll give you my two cents though.
I used to use ultra edit. Now I use netbeans, its a fully integrated development environment and it makes my life soooo much easier. Its free too. I can't imagine ever going back to UltraEdit. Also, which brings me to number two, netbeans has SVN and CVS integration
I would use subversion for version control. In my experience it does everything you need for version control. Others use ones like git and mercurial, but I think SVN is widely supported and easy enough to set up. As far as pushing code to the server, i've begun using svn for this too. I first ssh into the server and checkout the code into the public_html directory, and then set up an alias to do svn updates through the command line... its way easier than ftping in my opinion. There are other deployment methods, but i've never used them. see this question:
What is your preferred php deployment strategy?
obviously shared hosting is not going to handle traffic as well as a dedicated server. But there are lots of things you can do to improve performance before moving to a dedicated server. Check out this article: http://developer.yahoo.com/performance/rules.html
It seems that you're after a robust deployment strategy as opposed to a development one. But, correct me if I'm wrong.
In terms of 'code writing tool', and
IDE choice is a subjective
discussion. Feel free to work with
the one you are most comfortable
with, for me this is Netbeans.
As for a deployment strategy, I think it was best summed up in this answer.
Your point about scalable hosting is fairly broad. We will need much better forcasted metrics to give better advice. However, for now, if scalable hosting is a worry then maybe look into some sort of Cloud Hosting.
Have you looked at using wamp/xamp/mamp/lamp for development locally? Uploading via ftp for every change is a pain.
You could do that for local and see that everything works, then push it to your test domain and run through it again and then finally push live.
Might want to look at something like SpringLoops for doing your version control - this has the advantage of doing the deploy and then if it goes pear shaped you can revert it (free account gets 3 deploys a day).
I wouldn't worry about scaleable hosting just now, just focus on the site and the coding, you've only got a few users - wait till it starts becoming a problem before moving (however, I suggest looking into options) but don't try and get all cloud ready - might not ever be a problem.
ps, go with Linode over Slicehost.
I think use Aptana Studio ( http://www.aptana.org ). It is an Eclipse based IDE with all the tools you need integrated in it. It has integrated PHP development tools, GIT or SVN for version control.
I've used shared hosting as well. Once an other site on the same server had DoS atacks and my site became unreachable as well. Otherwise it could work in reasonable speed after some optimization. It served 1000-3000 users per day.
Dedicated servers are much better. Or you can use Amazon web services. I know they are more expensive.
1 - code writing tool
Zend Studio. I would recommend Linux as well if you are going to use linux servers.
2 - version control / management
SVN + phing (if you are going to build serious applications).
3 - scalable hosting
Amazon or RackSpace.
For your editor, just use what you are comfortable and productive with. You most definitely should have version control in place. You never know when you need to rollback a version or two.
I always keep at least 3 versions on the production server. I use symlinks to point the web server at the latest version. If there is a problem, you just need to recreate the symlink to point to an older version.
As for shared hosting, you'd be surprised out how much bandwidth you can get. I have a $10/month shared host that gets about 500K page views a month. Generally, it's not that your shared host can't handle the load, it's that the hosting provider puts too many "shares" on the same server. So it depends on how much resources everyone else on the same server is using. If you are having issues, you can always ask to be moved to a different server.

Version control for PHP Development [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
I have been hearing a lot about the advantages of using a version control system and would like to try one. I was doing freelance web development in PHP for the past 2 years, two months back I hired two more programmer to help me. I will be hiring one more person soon. We maintain 4 websites, all of which are my own, which are continuously being edited by one of us. I learned PHP by myself and have never worked in any other firms. Hence I am new to version control, unit testing and all.
Currently, we have development servers on our workstations. When we edit a particular section of a site, we download the code for that particular section (say /news/ or /movies/ or /wallpapers/ ) from the production server to the dev server, makes the changes locally and uploads to the production server (no code review / testing). Because of this, our dev server is always out of date from our prod server. Occasionally, this also create problem when one of us forgets to download the latest copy from prod and overwrites the last change. I know this is very very foolish, but currently our prod server is the only copy that has all the updates and latest changes.
Can anyone please suggest which is the best version control system for me? I am more interested in distributed version control, since we don't have a central backup for all our code. I read about Mercurial and Git and found that Mercurial is used in several large open source projects by Mozilla, Sun, Symbian etc. So which one do you think is better for me? Not only version control, if there are any other package that I can use to make my current setup better, please mention that too :)
It sounds like Git can accomplish your goals quite well. As it's distributed, it's excellent for working locally since you can perform most operations (commit, revert, diff, patch) without connecting to a central server. You can also avoid that ugly moment of someone pushing new code to production while someone else is working on it, and then having the complicated task of merging those two versions of the code together (git provides a useful tool for doing this called rebase).
You noted there's some big projects using Hg (Mercurial), but there's some pretty big ones using Git, like the Linux Kernel, X.org, Android and Debian.
I use git for all my sites: it's lightning fast, efficient, and easy to use.
Edit: If you want to get into using Git, I'd recommend doing some reading before jumping right in. Starting off on the wrong foot can have some terrible implications later on. If you follow an Agile Workflow, you might want to check this out. Here's a website I learned most of my Git know-how from.
Version control is an incredible tool even when you're working alone, and when you are working with someone else it's indispensable. I would recommend using git. It's very fast, has a really great set of available tools, and of course has github.com. Mercurial is basically just as good as git, but it runs a little slower and doesn't have github.
For why to use git, please read http://whygitisbetterthanx.com/
Here's a nice-looking tutorial on getting started with git: http://www-cs-students.stanford.edu/~blynn/gitmagic/index.html
You can use SVN, Git, Mercurial.
The biggest challenge is having everyone be disciplined in using version control and not getting lazy.
Definitely Mercurial. Although you can use either Git or SVN, Mercurial is better for two reasons:
Vs Git: Good integration with Windows.
Vs SVN: It's distributed.
If you don't want to run yourself a Mercurial server (which is pretty easy anyway), there are many services available. Kiln + FogBugz is an EXCELLENT combination. There's also CodeBaseHQ (also supports Git and SVN), Bitbucket, and many more.
Before you jump onto it I strongly recommend you read at least Joel Spolsky's tutorial, but I strongly recommend you also read Mercurial: The Definitive Guide.
I am sorry, I had no intention of starting a DVCS holy war. I am going to try Git.
Yes, version control will help. To get started, I see two important issues for you:
hosted or self-managed? Do you want to host this yourself on a server, or want a service to take care of it for you? There are reasons to go either way, but if you're not that into managing the server look for a hosted option.
SVN or Git There are others, but these are the top open source contenders.
Pros and Cons (my opinion):
SVN: Good tutorials and fairly easy to get up-to-speed with. The training requirement is small (I've done a bit of it). SVN works really well with a co-located team, lots of projects, etc. With a limited number of branches (you may not need any), it is solid. There are plenty of integrations with other tools.
Git: Getting started can be a little rougher than with SVN. Some of the docs are good, but lots are geared assume a rather thorough understanding of the internals. Once you get the hang of it, it has great flexibility, but I've seen almost everyone who has started with it really stumble when beginning. Even after working with it for months, people debate the best patterns to use. It's really sweet for 1-person projects (where you want to track history), and for distributed projects like GitHub. I use Git even for small co-located teams, because I enjoy the speed and flexibility.
Given what you say about your team, though, I'd probably recommend trying SVN. There will be better resources to help you get going, and you'll be less likely to get frustrated with it.
Hope this helps.

PHP Build system [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I'm using PHPUnderControl which runs on top of Cruise Control for my continuous integration and unit testing. I also have it setup to run PHPDocumentor to generate phpdoc's for me and it runs PHP Code Sniffer to enforce coding standards for me. But now I want to set up something on that same server (Ubuntu) to make deploying to a remote server easier. I already have it setup so after every successful build an SVN Export is done from trunk into a directory within the projects folder on the server.
I've been thinking of writing a little custom PHP script that will SSH to a configured remote server, tarball up the latest export, copy it over, untar and run any migrations. A PHP script like this shouldn't be too hard initially, unless I need to eventually begin scaling to multiple servers. I know there are systems out there like Phing, Fabric and others.
My question is if anyone has any experience with these and can provide some pro's and con's? I've begun setting up Phing on my server and will be trying Fabric next to play with them, but was wondering if anyone who has used them more extensively, or had to scale them, could provide some feedback.
I've used Capistrano with PHP (even though it's more of a Rails-y thing as it's written in Ruby).
It's been really straightforward to use, but that said I haven't had to scale much with it. We do deploy to various different staging/production servers though, and the multi-stage extension has been useful in those scenarios.
However like most things Ruby, there's a lot of hooks and "magic" which can get confusing if you're new to Capistrano and trying to do something tricky with it.
As for how it compares to other deployment tools, I can't comment. I know we used to use Phing, but I'm uncertain why we switched to Capistrano.
If you like Capistrano, but wished it was a bit more PHP'ish, check out Fredistrano.
I wrote an automated build (SVN export, Zend Guard encoding, etc) and deployment system using Phing once and found quite the pain to use. Whenever I had to write a special task I felt I had to jump through way to many hoops just to get it to work.
So, these days I just write simple bash scripts that does building with SVN checkout, encoding, creating a tag in SVN and deployment through rsync. It may be low-tech, and Phing may have some superior features, but atleast it doesn't get in my way.
Theres a new build tool, called Bldr. It uses Yaml for config, instead of xml like most of the build systems out there, and its highly extensible.
http://bldr.io
We use phing and it has come in handy. We don't use it for packaging, but it shouldn't be too hard to make it do what you are looking for. We mainly use it for common tasks such as clearing caches, building development sites, and other tasks to aide in development. Its been a big help, and from what I can gather it seems to be an ant clone, although it might not have all the functionality that ant has.
If I was to implement such a deployment system, I would probably opt for a slightly different solution from what you've outlined above. Instead of having code that runs locally on my system, connects to a list of remote servers and does the "work" there, I would pack the updater module with the rest of the code and have it pull the update data from my server on demand (or rather when I "told" it to do so). That way you have much less to worry about on your end (you just need to serve the updated code via http when requested, and the remote server handles the rest). Just my 2 cents.
I've written my own rsync like tool for this because i work from a very bad internet connection in a 3rd world contry and have all kinds of failures and starving connections so that rsync does not work.
On your remote system you should at least write a litte script that is doing backups before running migrations.
Better is you are using a total independent mirror system on your web host system and include some small but fundamental unit tests after a migration. Then do a root switching to put the updated website online. This would require to run a few interactive services in read-only mode during migration (unfortunately a feature that not many people implement).
But first of all - think if it is really worth your time doing this - if you only update each a quarter then a simple checklist on paper would be enough.

How to get started with version control and PHP [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I have absolutely no idea about version control. Only that it can be very useful in many ways.
I have found a few related questions but none that start from the absolute beginning.
I am the only developer at my work using Mac OS X and traditionally just been using FTP.
Can anyone help me with version control in relation to PHP projects (does it matter)?
Yes, try it out, it's worth it. And the language you are using doesn't matter. It's working great with PHP for me and it will for you too.
Benefits
If you are the only developer, it is indeed easier to go without version control. However, you will find great benefits to using a version control system. Some of the easiest benefits will be:
Never wondering what is your latest version once you go back to a project (no more myproject090201-archive2-final6.zip)
Never fear to start off some major refactoring, if you make a mistake on your file, you'll just rollback to the latest version
If something stops working in your project and you have the feeling it worked at one point, you can test some of the prior versions easily and look at the difference between the working version and the non-working version to find what broke the code
Additional backup of your current project, and even better if it's not on your machine... of course, additional points for backing up your version control system, we're never too cautious, you don't want to have to restart that month-long project do you?
Choices
As some have said, you have a few choices for your version control system and I guess you'll want a free one to begin. There are a few excellent commercial products but the free ones have nothing to be ashamed of. So here are some very popular free version control systems:
Subversion (also called SVN)
Git
Mercurial
Bazaar
Centralized versus distributed
Subversion has been there for a while and it's one classified as 'centralized'. Meaning everyone will always go fetch the latest version and commit their latest work to one central system, often on another system although it can easily be on your own machine. It's a process easy to understand.
The three others are called 'distributed'. There's a lot of different possible processes as it's a more flexible system and that's why those three newcomers are getting a lot of traction these days in open source projects where a lot of people are interacting with one another. Basically you are working with your own revisions on your own machine, making as many copies as you need and deciding which versions you share with other people on other computers.
The trend definitely seems go towards distributed system but as those systems are more recent, they are still missing the GUI tools that makes it really user friendly to use and you might sometimes find the documentation to be a bit lighter. On the other hand, this all seems to be getting corrected quickly.
In your case, as you are working alone, it probably won't make a big difference, and although you'll hear very good points for centralized and distributed systems, you'll be able to work with one or the other without any problems.
Tools
If you absolutely need a GUI tool for your Mac, I'd then choose SVN to get initiated to source control. There are two very good products for that (commercial):
Versions
Cornerstone
And a few other ones (such as the free svnX) that are becoming a little bit old and unfriendly in my opinion but that might be interesting trying anyway.
If you don't mind not using the GUI tools, with the help of Terminal you'll be able to do all the same things with a few simple command lines with any of the aforementioned systems.
Starting points
In any cases, you'll want some starting points.
For Subversion, your first stop must be their free book, Version Control with Subversion. Take a few hours of your day to go through the chapters, it'll be time well invested. The introduction chapters are a good read even you don't want to use Subversion specifically because it'll get you to understand version control a little bit better.
For a distributed system, I've had fun with Mercurial but it's an easily flammable subject so I'll let you make your own choice there. But if you end up looking at Mercurial, have a look at this blog post, it was an excellent starter for me that'll get you up and running with the basics in a few minutes if you're already a bit accustomed to version control in general. Anyway, drop by Mercurial's homepage and have a look at the Getting Started section of the page.
Conclusion
Give it a go, invest a day trying it out with a few bogus files. Try out renaming files and directory, erasing, moving things around, committing binary files versus text files, resolving conflicts and reverting to older versions to get a hang of it. These are often the first few hurdles you'll encounter when playing with version control and it'll be painless if it's on a non-production project.
In any cases, it's something well-worth learning that'll be helpful with your solo projects as well as if you end up working with other developers at your current job or your next one.
Good luck!
The type of code is irrelevant.
One open-source and popular version control system is Subversion and there is a very good overview/manual here.
I use Git for PHP development.
It's fast, flexible, reliable, clean (CVS and SVN create a lot of hidden folders that I personally don't like).
Its distributed nature allow to work the way you want (with or without a central repository).
You can find more about it here:
Gitmagic
Speed Benchmarks
Moreover, you can get the Eclipse PDT (PHP Plugin) and use Subclibse in the IDE.
Versions is working well for another developer I work with. Additionally, if you are using Textmate the SVN bundle provides pretty much all you need for most parts of the Subversion workflow. I really like it.
The Project Plus plugin takes it a step further by adding small unobtrusive badges to versioned files in the project tree, showing at a glance the state of files in a project.
If you're on a Mac, do yourself a favor and pick up Versions, a beautifully designed (and highly functional) Subversion GUI. You'd do best to learn the terminology and get an idea of how Subversion works using a GUI before you jump to the command line. Once you're able to commit revisions of your code and run updates to get other people's work, then go back and read the red bean book (it really is the best way to learn Subversion in-and-out).
http://versionsapp.com/
use bazaar http://bazaar-vcs.org/
it's very nice and you can start using it in minutes.
Check out other options too - Miscrosoft's TFS (this not only used for source control system but for defect tracking, project management etc etc) , Bazaar, Git are popular ones.
Alex,
Version control (and some will scathe me for this statement) is not a trivial matter, and even very experienced developers get themselves into trouble. The most frequent causes for frustration are limitations of a particular product (Visual Source Safe is a famous one), and members of a team not following the same process, or not understanding the process at all.
This should not stop you from looking into using a source control tool - the opposite is the case. You can only use a tool effectively if you understand what it does and why.
I would recommend that you look into CVS. It has been around for many years, it is relatively simple to install, set up, and use, and while there are GUI clients available for most platforms, learning it from the command line may provide the best access to its features.

Categories