PHP网站,我应该开发成Linux发行版而不是Windows吗?

发布于 2024-07-06 09:50:37 字数 594 浏览 9 评论 0原文

几个月后,我开始了一个 PHP 项目,但我正在犹豫是否要像往常一样:在我的 Windows Vista 64 位机器上进行开发。 由于我对 Linux 的了解很少,我认为通过使用 Linux 发行版来学习是一个很好的方法。

你认为这是一个好主意吗?我会运行一个VirtualBox Ubuntu(在我的 Vista64 位上)。 我正在考虑安装 XAMPP 以便能够用 PHP 进行开发。

如果您认为这是个好主意,请随时向我推荐一些关于虚拟化操作系统或 Linux/dev 应该了解的教程。

更新 我已经在 Windows 上用 PHP 构建了许多网站,问题更多是通过虚拟机在 Linux 上进行开发来开始学习 Linux 是否是一个好方法? 我有4G内存,如果我在虚拟机中安装Eclipse会顺利吗? ETC。

In few months I start a project in PHP and I am hesitating to do like usual : develop on my Windows Vista 64bits machine. Since I know few things on Linux, I think it can be a good way to learn by working on a Linux distribution.

Do you think it's a good idea or not? I would run a VirtualBox with Ubuntu (on my Vista64bits). I was thinking to install XAMPP to be able to develop in PHP.

If you think it's a good idea, feel free to suggest me some tutorial about what I should know with Virtualizing an OS, or Linux/dev.

Update
I have build many website in PHP with Windows, the question is more about if it's a good way to start learning Linux by developing on it via a Virtual machine? I have 4 gigs rams, will it be smooth if I install Eclipse in the Virtual Machine? etc.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(13

掩饰不了的爱 2024-07-13 09:50:37

您确实应该在要部署的同一平台上进行开发。 我并不是说采取不同的做法不好,但从长远来看,它可以减轻你的痛苦。 OTOH,这样您可能会更快地了解平台差异。 所以,主要的问题是:你想让一个生产系统尽快运行而不让人头疼吗? 或者,您想花一些时间和精力来学习如何开发跨平台的东西?

是的,确实存在差异。 例如,区分大小写和不区分大小写的文件名。 然后,一些 PHP 函数使用具有不同实现的本机 C 函数。 例如,printf() 不会为某些类型生成相同数量的空白。 时间测量的分辨率(毫秒与微秒)可能不同,等等。然后,您可以采用不同的方式处理文件系统权限。 这些只是我最近发现的一些我能记在脑子里的问题。

You should really develop on the same platform where you are going to deploy. I'm not saying it is bad to do differently, but it can save you some pain in the long run. OTOH, you might learn faster about platform differences that way. So, the main question is: do you want to have a production system running ASAP without much headache? Or, you want to spend some time and make some effort to learn how to develop cross-platform stuff?

And yes, there are differences. For example, case sensitive and case in-sensitive filenames. Then, some PHP functions use native C functions that have different implementation. For example, printf() does not produce the same amount of whitespace for some of the types. Resolution of time measurement (milliseconds vs microseconds) can be different, etc. Then, you have different ways filesystem permissions are handled. These are just some recent problems I've found that I can remember off the top of my head.

小嗲 2024-07-13 09:50:37

PHP 应该在任何平台上都是相同的 - 所以在哪里您开发应该不重要。

然而,根据我的经验和观察,更多运行 PHP 的网站在 Linux 上运行,而不是在 Windows 上运行。

在 Ubuntu 或 Fedora 等系统上安装 Apache 和 PHP 很容易,并且测试所有内容也非常简单。

另外,当您的网站上线时,它将在什么平台上运行? 我更喜欢在可能的情况下在运行它的平台上进行开发。

PHP should be the same on any platform - so where you develop shouldn't matter.

However, in my experience and observation,more sites running PHP are running on Linux than Windows.

Getting Apache and PHP setup on something like Ubuntu or Fedora is a cinch, and testing everything is pretty simple, too.

Also, when you go live with your site, what platform will it be running on? I prefer to do development on the platform it will be running on whenever possible.

把昨日还给我 2024-07-13 09:50:37

就我个人而言,我认为对于本地生产,您不应该使用虚拟机。 您是否也会在虚拟机内运行您的 IDE?

如果您足够了解在 Windows 和 Linux 环境之间移动的陷阱(例如区分大小写和权限),那么在 Windows 上进行开发并在 Linux 上进行部署应该没有问题。

Personally, I don't think that for local production you should be using a VM. Would you be running your IDE inside the VM too?

If you are aware enough of the pitfalls of moving between Windows and Linux environments (such as case sensitivity and permissions), you should have no problem developing on Windows and deploying on Linux.

反话 2024-07-13 09:50:37

使用 Linux 发行版无疑是学习它的最简单方法。 设置一些服务器并进行一些开发工作是一个很好的开始。

虚拟化 Linux 也非常容易。 我已经做过好几次了,而且真的很引人注目。 另外,采用这种方式将使您轻松使用 Linux,这比像我一样跳进去并发现您的无线卡不受支持要好得多:)

至于 Linux 上的 PHP 开发...我已经在 Windows 上完成了一些 PHP 编码,并且在 Linux 上,我可以告诉你两者之间几乎没有什么区别。 我在两个平台和 Apache & MySQL / XAMPP 上使用 Eclipse。 我所看到的唯一主要区别是 Linux 对于权限和大小写更加挑剔。

Working on a Linux distribution is defnitely the easiest way to learn it. And setting up some servers and doing some dev work is an excellent start.

Virtualising Linux is also really easy. I've done it quite a few times and it's really obious. Also, going this way will ease you into using Linux, much better than just jumping in and finding out your wireless card is unsupported like I did :)

As for PHP development on Linux... I've done some PHP coding on Windows and on Linux and I can tell you there's very little difference between the two. I use Eclipse on both platforms and Apache &MySQL / XAMPP. The only major difference I've seen is that Linux is much more finicky about permissions and case.

沒落の蓅哖 2024-07-13 09:50:37

PHP 在所有平台上都不相同,直到最近,Windows 版本还存在 Linux 版本中未发现的问题。 许多有用的功能都是 *nix 特有的。

我同意@Milan 关于在部署环境中进行开发的观点。 通过这样做,您也可以了解有关部署环境的更多信息。

关于虚拟机问题,如果您想要所有 Windows 工具和 Windows 计算机,请在虚拟机中设置一个 Linux 服务器(如果需要,可以有一个 GUI,但您将主要将其用作服务器)。 进行设置,以便 Windows 可以查看虚拟机中运行的 apache 安装,并且您可以使用 samba 共享来访问虚拟机的文件,就像 Windows 中的驱动器一样。 这样,您可以在 Windows 中进行开发,但可以在运行的 Linux 服务器上测试部署/设置。 虽然我商店的两名开发人员运行 Ubuntu,但第三位开发人员需要一直使用 Photoshop 和各种其他 Windows 软件,因此她使用这种在虚拟机中运行服务器但从 Windows 进行开发的方法。

哦,如果您在 Linux 上运行,请不要使用 XAMPP! 几个简单的命令即可让您启动并运行,并且您将更好地了解您的部署。 XAMPP 很好,但它适用于没有 Linux 包管理的操作系统。

PHP is not the same on all platforms, and until very recently the windows versions had problems which were not found in the Linux versions. Lots of useful features are *nix specific.

I would echo @Milan's sentiments about developing in the deployment environment. You learn a lot more about the deployment environment by doing so too.

On the VM issue, if you want all your Windows tools and your windows machine, setup a linux server in your VM (can have a GUI if you want, but you're going to mainly use it as a server). Set it up so that windows can view the apache install running in your VM and you use samba shares to access the vm's files like a drive in windows. That way, you develop in windows but are testing deploy / setup on a running linux server. While two devs at my shop run Ubuntu, a third needs to use Photoshop and various other bits of windows software all the time, so she uses this method of running a server in a VM but developing from windows.

Oh, and if you're running on Linux, don't use XAMPP! A few simple commands will have you up and running and you'll get a much better understanding of your deploy. XAMPP is fine, but it's for OS's that don't have Linux's package management.

っ〆星空下的拥抱 2024-07-13 09:50:37

虽然 XAMPP 效果很好,但在 Linux 上运行 Apache 和 PHP 是必然的; 而在 Windows 上,这是您必须做的额外事情......和支持。 此外,该堆栈的大部分部分对于 POSIX 环境来说都更加优化和成熟。 数据库引擎的性能对可用原语特别敏感。

大多数 OSS 都在 Windows 上运行,但它是一个钉在方孔上的圆钉。

while XAMPP works great, running Apache and PHP on Linux is a given; while on Windows it's something extra you have to do... and support. Also, most parts of the stack are far more optimised and mature for a POSIX environment. The database engine(s) performance is particularly sensitive to the available primitives.

Most OSS runs on windows, but it's a round peg whammed on a square hole.

信仰 2024-07-13 09:50:37

原则上,我建议不要在实际项目中“边做边学”——除非它真的很小,或者你以前做过非常相似的项目,这样项目相关问题的学习曲线就不会很陡峭。 在这种情况下,您可能有免费资源来了解开发环境。

On principle, I would advise against "learning by doing" in a real project - unless it it really small, or you have doen very similar projects before, so that the learning curve on project related issues would not be steep. In that case you may have ressources free for learning about the developing environment.

蓝梦月影 2024-07-13 09:50:37

一般来说,我比 Windows 更喜欢 Linux 环境。 主要是因为提供了您需要的所有 CLI 工具,并且 Bash 随时胜过 cmd.ext。 但有了 Cygwin,我发现 Windows 也是一个舒适的开发环境。

关于 PHP 开发,我真的看不出它会有什么不同。 如果您使用 Booth 系统,那么被迫使代码更具可移植性(例如行结尾、文件名中的正斜杠等)也许有一些好处。

作为台式机或工作站,两者之间没有太大区别。 我发现最大的差异在于你如何管理它们,但希望有其他人为你做这件事。

Generally I like the Linux environment better than Windows. Mainly because all the CLI tools you would need are provided and Bash beats cmd.ext any time. But with Cygwin I find even Windows a comfortable development environment.

Regarding PHP development I can't really see how it would be much different. Maybe there is some benefit in being forced to make the code more portable (things like line endings, forward slashes in filenames and such) if you use booth systems.

As a desktop or workstation there isn't much difference between the two. I find that the biggest differences lies in how you administer them, but hopefullt you have some other people doing that for you.

梦开始←不甜 2024-07-13 09:50:37

在我看来,你不需要在 Linux 发行版中进行开发。
Web 开发可以在任何操作系统上完成。 我不知道,作为专业人士,您为什么要进行网络编程? 您的个人主页?
我认为,获得一些运行 PHP 服务器的免费网络空间并在那里上传文件就足够了……它不会花费您太多时间,而且需要管理的事情也更少。

一名德国学生;)

In my opinion you needn't to develop in a linux distribution.
Web Development can be done from any OS. I don't know, why you are programming for the web... as a professional? for your personal homepage?
I think, it's enough to get some free webspace running a PHP Server and to upload your files there... it doesn't take you much time and there are less things to manage.

a german student ;)

神回复 2024-07-13 09:50:37

使用部署服务器将运行的操作系统,很可能是 Linux。 我最近看到一个部署非常糟糕,因为它是使用 wampserver 开发并部署在 CentOS 上的。 apache 和 PHP 配置有主要区别。 因此,了解您的部署服务器并尽可能匹配它。

Use the OS your deployment server will be running, and it is highly probable to be linux. I have recently seen a deployment gone ultra bad cuz it was developed using wampserver and deployed on CentOS. With major differences in apache and PHP config. So know your deployment server and match it as closely as possible.

月隐月明月朦胧 2024-07-13 09:50:37

尝试使用 VmWare Player 创建开发环境。 我的 Vista 笔记本电脑上运行着多个 Linux 环境。 您也可以只进行双启动。 我用的是Ubuntu,很简单。

Try creating a development environment using VmWare Player. I have several Linux environments that I run on my Vista laptop. You could also just dual boot. I use Ubuntu, it is easy.

半暖夏伤 2024-07-13 09:50:37

在虚拟机内开发的副作用:更多的开销,最终需要额外的工具来使开发更加舒适。
人们通常需要特殊的工具来进行开发,例如 Photoshop 或一些 Linux 上不可用的矢量设计工具。 如果项目的工作副本位于虚拟机内部,则可以轻松访问它。 因此,您将设置 SAMBA(这通常会导致 XP 登录出现问题)或设置 SSL(SFTP)/FTP。
此外,您还必须了解如何使用虚拟机的网络(NAT、桥接、端口转发)。

另一方面,在另一个平台上作为目标进行开发可能会让人头疼。 我发现自己经常对用于密码保护的 .htaccess 文件感到困惑,因为 Windows/Linux 上的路径通常不同。 如果您忘记稍后在生产服务器上更改此条目,则会遇到问题...

更好的解决方案:使用两全其美的方法。
虚拟机最终在 Ubuntu/Debian/FreeBSD 上无头运行(没有 GUI,更像是“远程服务器”),并且只运行所需的服务器(Apache、MySQL、FTP、SSH...)。

Windows/Mac 上的 Eclipse 或其他开发工具。

The side effect of developing inside a VM: more overhead and eventually the needs of additional tools to make the development more comfortable.
Often people need special tools for their development like Photoshop or some vector design tools not available on Linux. If the working copy of the project is inside the VM, it makes sense to have easy access to it. So you will setup SAMBA (which makes often problems with the login from XP) or setup SSL(SFTP)/FTP.
Also you must learn how to use networking with the VM (NAT, bridging, port forwarding).

On the other side, developing on another platform as the target can give some headache. I found myself often confused with .htaccess files for password protection, because oft the different path on Windows/Linux. If you forget to change this entries later on the production server, you have a problem...

A better solution: use the best of both worlds.
A VM eventually running later headless (no gui, more like a "remote server") with Ubuntu/Debian/FreeBSD) and only running the needed servers (Apache, MySQL, FTP, SSH...).

Eclipse or the other development tools on Windows/Mac.

迷途知返 2024-07-13 09:50:37

5年后:我的意见是使用Linux解决方案。 在 Linux 中使用 PHP 有很多优点。 主要原因是社区提供的帮助水平。 PHP 似乎也针对 Linux 环境进行了优化。

数量也很安全,因为绝大多数站点都是使用 LAMP 解决方案托管和运行的。 有多种框架和 CMS 在采用 Apache2 的 Linux 上运行效果最佳。

让您的生活更轻松,立即开始学习 PHP。

5 years later: My opinion is to use the Linux solution. There are many advantages for using PHP in Linux. The primary reason is the level of help available from the community. PHP seems to be optimized for Linux environments as well.

There is also safety in numbers as an overwhelming number of sites are hosted and run with LAMP solutions. There are a wide range of frameworks and CMS' that run best on Linux with Apache2.

Make your life easier and start learning PHP straight away.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文