PHP中PHAR存档的优势 [英] Advantages of PHAR archives in PHP

查看:71
本文介绍了PHP中PHAR存档的优势的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

PHP 5.3具有一个称为 PHAR 的新功能,类似于JAVA中的 JAR .它基本上是PHP文件的存档.它有什么优势?我不明白他们如何在网络场景中提供帮助.

PHP 5.3 has a new feature called PHAR similar to JAR in JAVA. It's basically a archive of PHP files. What are its advantages? I can't understand how they can be helpful in the web scenario.

除易于部署"以外的任何其他用途-只需复制一个文件即可部署整个应用程序

Any other use other than "ease of deployment" - deploy an entire application by just copying one file

推荐答案

开放源代码项目有很多好处(无特定顺序).

There are tremendous benefits for open source projects (in no particular order).

  1. 更轻松的部署意味着更容易采用.想象一下:您可以通过将CMS,论坛或博客系统拖到FTP客户端中来在其网站上安装它. 就是这样.

更轻松的部署意味着更轻松的安全性.如果您只需要担心一个文件,那么更新软件包的最新版本将变得简单得多.

Easier deployment means easier security. Updating to the latest version of a software package will be much less complicated if you have only one file to worry about.

更快的部署.如果您的Web主机不授予您外壳程序访问权限,则无需在上传前解压缩,这样就减少了按文件传输的开销.

Faster deployment. If your webhost doesn't give you shell access, you don't need to unzip before uploading, which cuts out per-file transfer overhead.

先天分隔.包中的文件与添加或自定义项有明显区别.您知道可以轻松地替换存档,但是您需要备份配置模板和自定义模板(它们并没有混合在一起).

Innate compartmentalization. Files that are part of the package are clearly distinguished from additions or customizations. You know you can easily replace the archive but you need to backup your config and custom templates (and they aren't all mixed together).

更轻松的库.您不需要弄清楚如何使用PEAR安装程序,也不需要弄清楚这个或那个库是否具有嵌套的目录结构,或者是否必须包括X,Y或Z(按此顺序?).只需上传,包括存档,开始编码.

Easier libraries. You don't need to figure out how to use the PEAR installer, or find out whether this or that library has a nested directory structure, or whether you have to include X, Y, or Z (in that order?). Just upload, include archive, start coding.

易于维护.不确定更新库是否会破坏您的应用程序?只需更换它.破碎的?恢复一个文件.您甚至不需要触摸您的应用程序.

Easier to maintain. Not sure whether updating a library will break your application? Just replace it. Broken? Revert one file. You don't even need to touch your application.

所见即所得.很有可能,某人不会麻烦查找归档文件,因此,如果您看到维护的系统上安装了一个文件,则可以确信该文件不会引发某人的小虫虫.哈希可以快速告诉您它是哪个版本,或者是否已更改.

What you see is what you get. Chances are, someone is not going to go to the trouble of fudging with an archive, so if you see one installed on a system you maintain, you can be fairly confident that it doesn't have someone's subtly buggy random hacks thrown in. And a hash can quickly tell you what version it is or whether it's been changed.

Poo-poo不会使部署事情变得更容易.对于本地的SaaS来说,这没有什么区别,但是对于任何运送或安装PHP软件包的人来说,这都是改变游戏规则的事情.

Don't poo-poo making it easier to deploy things. It won't make any difference for homegrown SaaS, but for anyone shipping or installing PHP software packages it's a game-changer.

这篇关于PHP中PHAR存档的优势的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆