使用WampServer进行本地开发

tech2023-11-11  92

I began taking on-line development classes offered at my local college, and students had to upload their scripts and files via FTP to a school server for processing. The necessary security precautions required a boatload of username/password combinations that were strictly enforced and a pain to remember. Getting my project onto the school’s server was possible, but it was easier for me to develop my project locally before uploading them to where they eventually needed to be.

我开始参加当地大学提供的在线开发课程,学生不得不通过FTP将其脚本和文件上传到学校服务器进行处理。 必要的安全预防措施要求严格执行一系列用户名/密码组合,并且要记住一些麻烦。 可以将我的项目放到学校的服务器上,但是对于我来说,在将项目上传到最终需要的地方之前,在本地开发我的项目要容易得多。

This article will explain how a development system solves such a problem and how to install the popular Windows-based web development platform WAMP. As a relative newcomer to the PHP language, I hope this article speaks directly to other new programmers who are interested in honing their development skills to eventually become PHP masters.

本文将解释开发系统如何解决此问题以及如何安装流行的基于Windows的Web开发平台WAMP。 作为PHP语言的新手,我希望本文直接与其他有兴趣磨练其开发技能以最终成为PHP大师的新程序员交流。

开发服务器 (The Development Server)

Every programmer needs a place to write and develop their programs.

每个程序员都需要一个编写和开发程序的地方。

A development system is a computer with a group of applications that are installed that perform the same tasks as on a web server. The benefits of this is being able to develop and test your scripts locally without having to upload them first, and the security of maintaining your files locally until they are ready for their intended purpose. Plus you don’t have to be connected to the Internet while you work. We are pretty much always on-line nowadays, but every so often you can find yourself without a connection to the web. Who knows, you may want to crunch code on a laptop while sitting on a beautiful secluded beach.

开发系统是一台装有一组应用程序的计算机,这些应用程序执行与Web服务器上相同的任务。 这样的好处是能够在本地开发和测试脚本而不必先上传它们,并且可以安全地在本地维护文件,直到它们准备好达到其预期目的为止。 另外,您在工作时不必连接到Internet。 如今,我们几乎总是在线,但是每隔一段时间,您都可以找到自己,而无需连接到网络。 谁知道,您可能想坐在美丽的僻静海滩上使用笔记本电脑处理密码。

什么是WAMP服务器? (What is a WAMP Server?)

A WAMP server is a computer running these applications:

WAMP服务器是运行以下应用程序的计算机:

Windows OS

w ^ INDOWS OS

Apache

一个帕什

MySQL Database

中号 ySQL数据库

PHP

P HP

There are many variations, and you may have come across the term LAMP server before. This is essentially is the same as WAMP except it is based on the Linux operating system.

有很多变体,您以前可能曾经使用过LAMP服务器一词。 除了它基于Linux操作系统以外,它与WAMP本质上相同。

There are also various ways to construct your WAMP server. If you are bold and fearless, you can download and install Apache, MySQL, and PHP individually on your machine, and if all goes well you will end up with a sweet WAMP server. Or if you are like me, you will take the advice of many wise men and install a Windows-based server package of which there are several. I choose to install WampServer. WampServer is open source, free to use under the GPL license agreement, relatively simple package that automatically installs everything you need to start developing.

还有多种构建WAMP服务器的方法。 如果您大胆而无所畏惧,则可以在计算机上分别下载并安装Apache,MySQL和PHP,如果一切顺利,您将获得一个不错的WAMP服务器。 或者,如果您像我一样,您将接受许多智者的建议,并安装一个基于Windows的服务器软件包。 我选择安装WampServer。 WampServer是开源的,根据GPL许可协议可免费使用,它是相对简单的软件包,可自动安装开始开发所需的一切。

WampServer even includes a great graphical tool, phpMyAdmin, which helps handle the administration of MySQL. If you have ever dealt with MySQL and its initially intimidating command line interface, you will immediately appreciate how phpMyAdmin helps with creating databases and tables and modifying data within them. Plus, familiarizing yourself with phpMyAdmin may come in handy as many web hosts restrict access to the command line for security reasons.

WampServer甚至包括一个出色的图形工具phpMyAdmin,可帮助处理MySQL的管理。 如果您曾经使用过MySQL及其最初令人生畏的命令行界面,您将立即了解phpMyAdmin如何帮助创建数据库和表以及修改其中的数据。 另外,熟悉phpMyAdmin可能会派上用场,因为出于安全原因,许多Web主机限制了对命令行的访问。

如何使用WampServer (How to Use WampServer)

Go to the WampServer homepage and download the package that is applicable for your local machine. The current version available is 2.2E. The application is constantly updated, so plan on checking in periodically to ensure you have access to the latest version available.

转到WampServer主页,并下载适用于本地计算机的软件包。 当前可用的版本是2.2E。 该应用程序会不断更新,因此请计划定期检入以确保您可以访问可用的最新版本。

Once you have installed the package, you should see the WampServer icon in the Windows system tray next to the clock display. You may need to click the “show hidden icons” up arrow to see it.

安装软件包后,您将在Windows系统托盘中的时钟显示旁边看到WampServer图标。 您可能需要单击向上箭头“显示隐藏的图标”才能看到它。

The WampServer menu has links to several related pages and folders.

WampServer菜单具有指向多个相关页面和文件夹的链接。

The uppermost and most important page is Localhost. Clicking Localhost brings up your browser and displays the WampServer menu page which confirms the server is functioning correctly. You will see the versions of all applications and extensions that are installed under the Server Configuration heading.

最重要的页面是Localhost 。 单击Localhost会打开您的浏览器,并显示WampServer菜单页,以确认服务器正常运行。 您将在“服务器配置”标题下看到安装的所有应用程序和扩展的版本。

Under tools are links to the phpinfo() function which, when clicked, will display all of the information related to your particular installation and configuration. Below that you will find a link to the above mentioned phpMyAdmin.

工具 phpinfo()是phpinfo()函数的链接,单击该函数将显示与您的特定安装和配置有关的所有信息。 在此之下,您将找到上述phpMyAdmin的链接。

Under the Your Projects heading is a display of the project folders you are working on. Each of your projects should be within its own folder. Your project folders are copied into the www subfolder within the wamp directory.

在“ 您的项目”标题下将显示您正在处理的项目文件夹。 您的每个项目都应位于其自己的文件夹中。 您的项目文件夹将复制到wamp目录下的www子文件夹中。

运行PHP脚本 (Running a PHP Script)

When clicked, all PHP files and scripts placed in the www folder will be processed by the Apache server where any PHP code will be parsed and processed by the PHP application. It’s almost magical how a PHP script can establish a database connection, execute a query against the database, and dynamically return the results to the client. Depending on the nature of your script, the results can be returned as HTML back to the client browser for display.

单击后,放置在www文件夹中的所有PHP文件和脚本都将由Apache服务器处理,在该服务器上,PHP应用程序将解析和处理任何PHP代码。 PHP脚本如何建立数据库连接,对数据库执行查询以及将结果动态返回给客户端,这几乎是神奇的。 根据脚本的性质,可以将结果以HTML格式返回给客户端浏览器进行显示。

During development, when PHP encounters any code errors (and trust me, as a newbie you will encounter many errors), PHP has the ability to display error messages that are great clues to finding the source of the error. The process of error checking and solution finding is part of the learning curve of any programming, and reason enough to set-up a local development server. Without it, one would go nuts having to upload each file revision using FTP to the web server.

在开发过程中,当PHP遇到任何代码错误时(并且相信我,作为一个新手,您将遇到很多错误),PHP能够显示错误消息,这些消息是找到错误来源的重要线索。 错误检查和解决方案查找的过程是任何编程的学习过程的一部分,并且是建立本地开发服务器的充分理由。 没有它,人们将不得不使用FTP将每个文件修订版本上传到Web服务器。

摘要 (Summary)

In closing, server-side programming without doubt has its challenges. But now you are aware that setting up a development server using WampServer can save a lot of time and frustration and provide you with the means to safely develop your next killer application on your local machine.

最后,毫无疑问,服务器端编程将面临挑战。 但是现在您知道,使用WampServer设置开发服务器可以节省大量时间和精力,并为您提供在本地计算机上安全地开发下一个杀手级应用程序的方法。

Image via Fotolia

图片来自Fotolia

翻译自: https://www.sitepoint.com/using-wampserver-for-local-development/

相关资源:jdk-8u281-windows-x64.exe
最新回复(0)