Skip to main content

Deploying PHP applications as PHAR archives

             
               Deploying PHP applications as PHAR archives

Today I discovered a very powerful addition to the PHP world. Phar is an archive extension for PHP that allows an entire PHP application to be packaged into a single file. It's basically PHP's answer to Java's .jar archive format. Don't get excited yet, it gets better...
There are a few things that make this particularly handy. For one, it is being integrated into the next major PHP release (5.3) which means that any standard PHP installation running the latest version will support .phar files right out of the box.
The other advantage is of course in deployment. Using a .phar file you can deploy an entire PHP application by working with just one file, rather than a bunch of files and directories. This is where .phar really shines. Imagine deploying a popular web app like WordPress by simply copying a single .phar file to your web server's root, rather than figuring out how to zip it up, upload it, and somehow unzip it remotely. Piece of cake!
The development side is equally as simple, being able to access files within the .phar file as easily as if it were another directory in the file system. The .phar file itself can be included in a script using any of PHP's standard import constructs (include, include_once, require, require_once). This also means external libraries can be more easily integrated, having just a single file to include in order to utilize a given library. A .phar archive can also be accessed as a stream using the same functions used to read/write other types of streams.
Certainly there are disadvantages as well, and this is not a one-size-fits-all solution. Using .phar files does result in a performance hit, meaning traffic-intensive sites and heavyweight applications are probably not the best place to use this tool. It also may not be ideal for a web app that is fairly modular, or other situations where source files might be added or removed on a regular basis. It does have its uses though, and for me it will be a welcome addition to the PHP core.
Reference:
#site_crafting

Popular posts from this blog

NOCOPY Parameter Hint in PL/SQL

Before we get to understanding the NOCOPY parameter hint in PL/SQL, it would help to first look at PL/SQL parameter modes and the ways in which they pass values in and out of a subprogram.





PL/SQL subprograms have three parameter modes:

IN parameter mode is used to send values into the subprogram from the calling program. An IN parameter can only be read, its value cannot be modified inside the subprogram.OUT parameter mode is used to return values from the subprogram to the calling program. IN OUT parameter mode is a hybrid of IN and OUT. It is used to send values into the subprogram, and its value can be modified within the subprogram. On exit, the subprogram returns the updated value of the IN OUT parameter to the calling program.  Continue reading at
Source :  NOCOPY Parameter Hint in PL/SQL

What is Bitnami ?

What is Bitnami ?


Bitnami makes it easy to run your favorite server apps anywhere



Bitnami is a library of popular server applications and development environments that can be installed with one click, either in your laptop, in a virtual machine or hosted in the cloud. We take care of compiling and configuring the applications and all of their dependencies (third-party libraries, language runtimes, databases) so they work out-of-the-box. The resulting packaged software (a 'stack') is then made available as native installers, virtual machines and cloud images. These Bitnami application packages provide a consistent, secure and optimized end-user experience when deploying any app, on any platform.


Bitnami Cloud Hosting Bitnami Cloud Hosting is a server management solution that makes it incredibly simple to launch and manage apps on Amazon Web Services. Users can launch all of the Bitnami application packages, build development environments, automate ba…

The Brain Regain

It's an article of : Mohammed BIN RASHID AL MAKTOUM, Vice President and Prime Minister of the United Arab Emirates and Ruler of Dubai. Written on : JUN 8, 2014 , from : The World's Opinion Page
DUBAI – In 1968, while studying at the Mons Officer Cadet School in the United Kingdom, I needed to visit a hospital. There I met a doctor who, to my surprise, spoke fluent Arabic. I learned that he was new to the UK, so I asked if he intended to stay long or return home. He replied with an Arabic saying that translates as: “My home is where I can eat.”
That doctor’s words stayed with me for many years, because they underscored the contradiction between our idealized view of “home” and the harsh realities of life that push talented people to leave their homes. The doctor was a classic case of the “brain drain” phenomenon that has afflicted developing countries for decades. These countries spend scarce resources educating doctors, engineers, and scientists, in the hope that they will be…