Deploying your work in Zend Studio is quite easy. You have the ability to deploy directly from your IDE, which is, in general, more for local environments, the Zend Developer Cloud or testing. The reason for this is because generally the developer should not have access to production. Therefore, the drag and drop deployment that Zend Studio supports is usually not going to be used, though in smaller development shops it may still be quite useful.
The deployment mechanism in Zend Server uses a ZPK file, which contains the source code, assets and the deployment descriptor. The deployment mechanism on the server side has already been discussed on this blog.
When creating a deployment package the first you need to do is either create a new project with deployment support
or add it by right clicking on your project and selecting “Add Application Deployment Support”
This will allow you to then either drag the project onto a target to deploy it or, as we’re talking about here, allow you to export it as we’re going to show here.
The deployment.xml file is where all of the configuration information resides. Double click on this file and you will get a display similar to this
Most of the fields are self explanatory but a few might require a few words.
- Document Root – This is the document root (duh) which is relative to the base directory of the deployment. Your project, in other words.
- License – This is the relative path to a text file in the project directory structure that contains the EULA for the project. During the deployment workflow in the UI the end user will be presented with this if the file is available and will be required to agree to it before proceeding.
- Persistent Resources – These are items that you don’t want to have overwritten during an upgrade. For example, cache directories.
- Variables you cannot change during the deployment process. What the value is in the deployment file is the value that you will get in the deployment script. Parameters need to be specified during the deployment workflow and also have some validation that you can do on the entered values whereas with variables you do not.
- Both are accessible via getenv() during deployment but variables are retrieved with their names “as is” but parameters are upper cased and prepended with “ZS_”. So if you have a parameter named “ugly_Duckling” it would be accessed via getenv(‘ZS_UGLY_DUCKLING’)
The last step is to export your project. Right click on the project and select Export and choose “Deployment Package”. This will output the project into a ZPK file that you can then upload to your Zend Server instance or Zend Application Fabric installation where it will be deployed to your website. Lickety Split.