如何在Windows上设置开发机器

Every developer is different. This article is not an explanation of what is “best” or what you “should” do, it is simply a look at one developer’s tools. I work with PHP, HTML, MySQL, CSS, and JavaScript, so pretty par-for-the-course web development here.

每个开发人员都是不同的。 本文并不是对什么是“最佳”或“应该”做什么的解释,而只是看一个开发人员的工具。 我使用PHP,HTML,MySQL,CSS和JavaScript,因此在这里进行了相当不错的Web开发。

SitePoint recently published an article on a similar theme, minus the “in Windows” part, written by Shaumik Daityari. He uses Ubuntu as his development machine, so I thought it would be nice to review a similar setup from the Windows side of things.

SitePoint最近发表了一篇关于类似主题的文章 ,减去了Shaumik Daityari撰写的“在Windows中”部分。 他使用Ubuntu作为他的开发机器,因此我认为最好从Windows方面回顾类似的设置。

全新安装 (A Fresh Install)

I’m going to assume I have a fresh install of Windows 7 Pro and starting from scratch. I use Ninite to install all my favorite tools on a new machine. These include the latest browsers, as well as:

我假设我从头开始安装了Windows 7 Pro。 我使用Ninite在新机器上安装所有我喜欢的工具。 其中包括最新的浏览器,以及:

These are some of the programs I install, but there are many more non-dev-related programs to fetch as well. If you haven’t used Ninite to setup a new machine, you’re missing out, it makes the process so much easier!

这些是我安装的一些程序,但是还有更多与开发人员无关的程序也可以获取。 如果您还没有使用Ninite来设置新机器,那么您会错失良机,这使该过程变得非常容易!

Getting ready to install programs with Ninite

关于基本工具 (About the Basic Tools)

As mentioned, I install all browsers so I can test locally on each one. There are web services that will show you how your project renders in different environments and on older browsers, if need be. You might want to check out BrowserShots or Browserling for multi-browser rendering. They both have free tests you can run.

如上所述,我安装了所有浏览器,以便可以在每个浏览器上进行本地测试。 有一些Web服务将向您显示项目(如果需要)如何在不同的环境中和在较旧的浏览器上呈现。 您可能想查看BrowserShotsBrowserling以进行多浏览器渲染。 他们都有免费的测试,您可以运行。

FileZilla is for my FTP needs, Notepad++ is my general text editor to replace Notepad in Windows (I also use a plugin to edit Hex files.

FileZilla可以满足我的FTP需求,Notepad ++是我的通用文本编辑器,可以代替Windows中的Notepad(我也使用插件来编辑Hex文件

WinSCP is a tool for working in the filesystem of my Linux servers over SFTP with a visual drag-n-drop interface, and PuTTY is my remote console SSH tool.

WinSCP是用于通过可视化拖放界面通过SFTP在Linux服务器的文件系统中工作的工具,而PuTTY是我的远程控制台SSH工具。

I use 7-Zip for compressed files, Greenshot for taking screenshots and annotating them, and Dropbox is where I keep a lot of files of individual clients with invoices, spec sheets, server and hosting information, to-do lists, training material, and a lot of other data. I also use Dropbox to share screenshots and files.

我使用7-Zip压缩文件,使用Greenshot截取屏幕截图并进行注释,在Dropbox上,我保存了许多个人客户的文件,包括发票,规格表,服务器和托管信息,任务列表,培训材料以及很多其他数据。 我还使用Dropbox共享屏幕截图和文件。

I’ll also mention Evernote as a brilliant note-taking application.

我还将提到Evernote作为一个出色的笔记应用程序。

Special mention are the following handy tools: ColorMania, jRuler, and of course Firebug for Firefox.

特别值得一提的是以下便捷工具: ColorManiajRuler ,当然还有适用于Firefox的Firebug

编者 (The Editors)

Next I need some apps not found on Ninite. I install:

接下来,我需要一些Ninite上找不到的应用程序。 我安装:

Readers here will be familiar with Sublime and NetBeans. I use Sublime mostly for getting projects started, working smaller projects, or doing quick edits.

这里的读者将熟悉Sublime和NetBeans。 我主要将Sublime用于启动项目,处理较小的项目或进行快速编辑。

NetBeans is for much larger in-house projects when I need all those extra features and references. I use Sublime’s “save_on_focus_lost” setting for all my editing; all I do is make my changes, then click over to the browser and refresh, Sublime saves automatically when losing focus. It also saves you from having to run a “Save-all” command if you have many tabs open, as it will save each tab when you click to another. Just add "save_on_focus_lost": true" to your user settings file.

当我需要所有这些额外的功能和参考时,NetBeans适用于大型内部项目。 我所有编辑都使用Sublime的“ save_on_focus_lost”设置; 我要做的就是进行更改,然后单击浏览器并刷新,Sublime在失去焦点时会自动保存。 如果您打开了许多选项卡,它还使您不必运行“全部保存”命令,因为当您单击另一个选项卡时,它将保存每个选项卡。 只需在您的用户设置文件中添加"save_on_focus_lost": true"即可。

Using Sublime Text 3

Notepad++, already mentioned, can also be tossed in as an editor, as I use it quite often when I want to open files outside the IDE environment.

已经提到的Notepad ++也可以作为编辑器使用,因为当我想在IDE环境之外打开文件时,我经常使用它。

There are many other tools for editing and seeing “live” changes as they happen without having to save, for example you might try JetBrains PhpStorm, or the very clever Brackets editor.

还有许多其他工具可以编辑和查看“实时”更改,而无需保存,例如,您可以尝试使用JetBrains PhpStorm或非常聪明的Brackets编辑器。

PhpStorm will cost you, but it is a very nice editor. I personally didn’t find Brackets very robust when I tested it some time ago, though it has probably improved a lot since then, and it is free and looks a lot like Sublime. Regardless of which editor you choose, it should be comfortable for you, and do what you need.

PhpStorm将花费您,但是它是一个非常好的编辑器。 我个人在一段时间前进行测试时并没有发现Brackets的功能非常强大,尽管自那时以来它可能已经得到了很大的改进,而且它是免费的,看上去很像Sublime。 无论选择哪种编辑器,它都应该适合您并按需要进行。

For my needs, and the projects I work on, I’m fine with an old school “save and refresh” method of editing. Sublime also has the best color theme (Monokai) that I’ve ever used, better than Monokai in any other editor I’ve tried. (Super tip: I use the font Consolas in 13 point for a near perfect editing experience!)

对于我的需要和我从事的项目,我可以使用老式的“保存并刷新”编辑方法。 Sublime还具有我使用过的最佳色彩主题( Monokai ),比我尝试过的任何其他编辑器都要好。 (超级提示:我在13点使用字体Consolas以获得近乎完美的编辑体验!)

Within Sublime, I install Package Control straight away. Next I search for some packages: I’ve installed Emmet, Phpcs, and Xdebug Client for example. The plugins I use will come and go; I like testing different code sniffers, coding standards helpers, language references and so on. I was working with the ProcessWire CMS recently and a quick search in Package Control found a plugin for adding ProcessWire snippets. You never know what you might find in there!

在Sublime中,我立即安装了Package Control 。 接下来,我搜索一些软件包:例如,我已经安装了Emmet,Phpcs和Xdebug Client。 我使用的插件会来来去去; 我喜欢测试不同的代码嗅探器,编码标准助手,语言参考等等。 我最近正在使用ProcessWire CMS,在Package Control中的快速搜索找到了用于添加ProcessWire代码片段的插件。 您永远都不知道在那里会发现什么!

DevDocs is not an editor, but a language reference tool I’ve been using for a while. It lets you select which languages you are interested in, and the fuzzy search tool will find whatever function you’re looking for as you type it.

DevDocs不是编辑器,而是我使用了一段时间的语言参考工具。 它使您可以选择感兴趣的语言,并且模糊搜索工具会在您键入时找到您要查找的任何功能。

Using DevDocs

Check out Bruno’s article on DevDocs if you want an overview of its features.

如果需要有关功能的概述,请查看Bruno在DevDocs上的文章

服务器 (The Server)

With all of that out of the way, it’s time to get a server running! This is where everybody is going to differ in how they work — my way is just one and some may argue it’s not even a good one! For the number and size of projects I work on, this method works great for me, but I do realize that in a larger environment with larger projects or when working on teams, etc, this may not be the best setup.

有了所有这些,就可以开始运行服务器了! 这是每个人在工作方式上都会有所不同的地方-我的方式只是其中一种,有人可能会说这甚至不是一个好方法! 对于我正在处理的项目的数量和大小,此方法对我来说非常有用,但是我确实意识到,在具有较大项目的较大环境中或在团队中工作时,这可能不是最佳设置。

I use WAMP directly on my machine. WAMP is, of course, the Windows Apache MySQL PHP server application. It installs quickly, requires very little configuration, and can be ready to serve your projects in no time.

我直接在机器上使用WAMP 。 WAMP,当然,在W INDOWS 一个帕什中号 ySQL P HP服务器应用程序。 它安装Swift,只需要很少的配置,就可以立即为您的项目提供服务。

WAMP Panel

I have also used a dedicated server in my office, a virtual machine (both locally and on other hardware), and cloud servers from InMotionHosting, DigitalOcean, HostGator, and others.

我还在办公室中使用了专用服务器,虚拟机(在本地和其他硬件上)以及InMotionHostingDigitalOceanHostGator等提供的云服务器。

If I work on a remote server, that is where I will use PuTTY, WinSCP and FileZilla. If I work on local hardware, I may use Remote Utilities, Terminals, or some other remote tools.

如果我在远程服务器上工作,则将使用PuTTY,WinSCP和FileZilla。 如果使用本地硬件,则可以使用Remote UtilitiesTerminals或其他一些远程工具。

If I use a Virtual Machine, it may be VirtualBox, or VMware vSphere. All of those alternate server configurations are, in my opinion, a little to a lot more complex to use, unless you set them on frequently. I don’t even have the space to begin talking about Vagrant or PuPHPet, which set out to make setting up virtual servers much faster and easier. Search SitePoint for “Vagrant”, “PuPHPet”, “Puppet”, “VirtualBox” and so on for more information about automation of virtual development servers.

如果使用虚拟机,则可能是VirtualBoxVMware vSphere 。 我认为,所有这些备用服务器配置的使用都会有些复杂,除非您经常设置它们。 我什至没有空间开始谈论Vagrant或PuPHPet,它们旨在使设置虚拟服务器变得更快,更容易。 在SitePoint中搜索“ Vagrant”,“ PuPHPet”,“ Puppet”,“ VirtualBox”等,以获取有关虚拟开发服务器自动化的更多信息。

If you need to match the specs of the live server exactly, you may be better off running a virtual machine and setting up the exact specs that way. This is where Vagrant would shine. DigitalOcean also has some options when setting up a “Droplet” as to what OS to run and so forth. Whatever the need, there is a solution!

如果您需要精确匹配实时服务器的规格,则最好运行虚拟机并以这种方式设置确切的规格。 这就是流浪汉闪耀的地方。 当设置“ Droplet”以运行什么操作系统时,DigitalOcean还具有一些选项。 无论需要什么,都有解决方案!

I use WAMP for all my initial development, testing frameworks and CMSes, writing small apps to help myself with projects, etc. It is quite powerful in letting you run different versions of PHP, MySQL, and Apache side-by-side, depending on your needs.

我将WAMP用于所有最初的开发,测试框架和CMS,并编写小型应用程序来帮助自己进行项目等。它非常强大,可让您并行运行不同版本PHP,MySQL和Apache,具体取决于您的需求。

One example where WAMP was quite helpful was in recovering MySQL data from an old backup of WAMP from years past. The data was in an older version of MySQL and couldn’t be opened, so I simply installed an old version of MySQL right in WAMP, accessed the data, exported it, switched versions back to the new one, and imported.

WAMP非常有用的一个示例是从过去几年的WAMP的旧备份中恢复MySQL数据。 数据位于旧版本MySQL中,无法打开,因此我只是在WAMP中安装了旧版本MySQL,访问数据,将其导出,将版本切换回新版本,然后导入。

数据库 (The Database)

I install Navicat for MySQL, my preferred database management tool. It is not free, but it’s not that expensive either if you use it professionally. You can manage remote databases, import and export many formats, merge databases, copy structures around, read server variables and status, repair DBs, sync data, automate backups, build reports and queries, the list goes on.

我安装了Navicat for MySQL ,这是我的首选数据库管理工具。 它不是免费的,但是如果您专业地使用它也不是那么昂贵。 您可以管理远程数据库,导入和导出多种格式,合并数据库,复制结构,读取服务器变量和状态,修复DB,同步数据,自动执行备份,构建报告和查询,此列表不胜枚举。

Something like PHPMyAdmin can probably get you 80% of the way there, but Navicat will enable some pretty cool stuff if you use it. I actually have it connected to every MySQL database I work on, on all our servers. It has been especially handy for me to use for importing CSV data. An alternate free MySQL manager I’ve used would be MySQL Workbench and HeidiSQL which also connects to multiple servers.

诸如PHPMyAdmin之类的东西可能可以为您带来80%的收益,但是如果您使用Navicat的话,Navicat将启用一些非常酷的东西。 实际上,我已将其连接到我在所有服务器上工作的每个MySQL数据库。 对于我来说,导入CSV数据特别方便。 我使用过的另一个免费MySQL管理器是MySQL WorkbenchHeidiSQL ,它们也连接到多个服务器。

Navicat for MySQL

(Domain)

If you develop this way, you will most likely run each project in a subdirectory of localhost. That is, “/localhost/projectA/” and “/localhost/projectB” for example. This is fine, but if you need to copy your project to a real web server, be aware to never use hard links to localhost! Always try to use relative links, and if you must use hard links, be aware of what will be needed to move your project to another domain (config edit, database update, etc).

如果以这种方式进行开发,则很可能会在localhost的子目录中运行每个项目。 即,例如“ / localhost / projectA /”和“ / localhost / projectB”。 很好,但是如果您需要将项目复制到真实的Web服务器,请注意,切勿使用指向本地主机的硬链接! 始终尝试使用相对链接,如果必须使用硬链接,请注意将项目移至另一个域(配置编辑,数据库更新等)所需的内容。

On a live server the project will likely run on the web root folder, whereas in WAMP it will likely be a subfolder of localhost. This will throw off links like “/images/” where the slash would normally take you to the root folder. On WAMP you still have to go to your project folder, such as “/projectA/images/”. You don’t want to hardcode your project folder either, so use a PHP variable to create links, or set the base directory in htaccess or PHP or whatever you use.

在实时服务器上,项目可能会在Web根文件夹上运行,而在WAMP中,它可能是localhost的子文件夹。 这将抛出“ / images /”之类的链接,其中的斜线通常会将您带到根文件夹。 在WAMP上,您仍然必须转到项目文件夹,例如“ / projectA / images /”。 您也不想对项目文件夹进行硬编码,因此请使用PHP变量创建链接,或者在htaccess或PHP或您使用的任何目录中设置基本目录。

This is especially important for CMSes like WordPress where some links have to be changed before the move, or other systems where you might even have to edit the configuration in the database itself after moving the site.

这对于WordPress之类的CMS而言尤其重要,在CMS中,必须在移动之前更改一些链接,或者对于其他系统,在移动站点后,您甚至可能不得不在数据库本身中编辑配置。

外部访问 (Outside Access)

If you want people outside your network to access your server, like I do, then you might set up a domain or subdomain to point to your IP address, such as “dev.example.com”. You have to open ports on your router and configure the firewall for this to work. This is the main drawback of “local” development. If you want “outside access” to view the websites, you’ll have to open up your machine to the world and work out some kind of user access security.

如果像我一样希望网络外的人访问您的服务器,则可以设置一个域或子域以指向您的IP地址,例如“ dev.example.com”。 您必须在路由器上打开端口并配置防火墙才能正常工作。 这是“本地”开发的主要缺点。 如果要“外部访问”来查看网站,则必须向外界开放机器,并制定某种用户访问安全性。

If you need to show a client your work, they need a way to view your server, so you might use htaccess passwords, or use a random port to direct port 80 traffic, or use an IP whitelist, or some other security measure.

如果您需要向客户展示您的工作,他们需要一种查看服务器的方法,因此您可以使用htaccess密码,或者使用随机端口来引导端口80流量,或者使用IP白名单或其他一些安全措施。

If you are open to the world, you will also have to find ways to prevent bots from scanning your projects and making the URLs public! Because we are using Apache, htaccess is your friend. Learn how to set up passworded folders, IP whitelists, and use robots files.

如果您对世界开放,那么您还必须找到防止机器人程序扫描您的项目并使URL公开的方法! 因为我们使用的是Apache,所以htaccess是您的朋友。 了解如何设置密码文件夹,IP白名单以及如何使用漫游器文件。

Inside WAMP, you’ll configure the port to listen on, and make sure you set your server to be “online”.

在WAMP中,您将配置端口以进行侦听,并确保将服务器设置为“在线”。

It is beyond the scope of this article to delve in to all of this configuring and security, but just be aware of it.

深入研究所有这些配置和安全性超出了本文的范围,但是请注意这一点。

On a related note, you might want to check out Patrick Catanzariti’s recent article on accessing localhost from anywhere, which might help in this area.

在相关说明中,您可能想查看Patrick Catanzariti最近发表的有关从任何地方访问localhost的文章,这可能会对这一领域有所帮助。

结语 (Wrapping it Up)

With my development machine set up in this way, I can create databases and manage them easily with Navicat, create new folders and work on projects instantly with Sublime.

通过以这种方式设置开发机器,我可以创建数据库并使用Navicat轻松管理它们,创建新文件夹并使用Sublime立即处理项目。

If I need source control for a project through GIT, which I do sometimes, I have SourceTree for this. It is a visual tool, which some of you purists may despise in favor of the command line, but I find it easy to use when needed. I have a Bitbucket account for these projects to live in.

如果我有时需要通过GIT对项目进行源代码控制,则可以使用SourceTree 。 它是一种可视化工具,一些纯粹主义者可能会偏爱命令行,但我发现它在需要时易于使用。 我有一个可用于这些项目的Bitbucket帐户。

Sourcetree with one project added

I hope you found this useful and maybe found a tool or two to add to your own development setup. Again, this works for me because I develop mostly internal company projects and tools, so I don’t require a team, or multiple locations to develop in, or even source control for most projects.

我希望您觉得这很有用,也许希望找到一两个工具添加到自己的开发设置中。 再说一次,这对我有用,因为我主要开发公司内部的项目和工具,因此我不需要团队或多个地点来进行开发,甚至不需要大多数项目的源代码控制。

Outside access is limited. I would recommend my setup for anyone just getting started in development and learning to code, as most of the tools are free, no command line knowledge is needed, and it’s easy to change settings and configurations.

外部访问受到限制。 我将向任何刚开始开发和学习编码的人推荐我的安装程序,因为大多数工具都是免费的,不需要命令行知识,并且更改设置和配置很容易。

Let me know your favorite Windows development tools in the comments. I am always open for trying new tools!

在评论中让我知道您最喜欢的Windows开发工具。 我总是愿意尝试新工具!

翻译自: https://www.sitepoint.com/how-set-up-my-development-machine-windows/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值