It’s all about the packages
Octopus, as we know relies on NuGet packages to deploy files. So to start we need to put all of our PHP files into NuGet Package. Lucky for us the NuGet Package Explorer has this covered. Adding files and creating a NuGet Package really couldn’t be easier.
Once my package was created, and uploaded to the internal NuGet repository in Octopus, I was ready to go!
Creating the Project in Octopus
I then created a new project, and selected the NuGet Package step.
As you can see I chose the Custom Install Directory, as I had a pre-existing site setup and I would like in this instance to always deploy to the same location. But we are using IIS so you can choose the other IIS options. I have also added a couple of other Octopus features to show that it can be used with .php files. So I made the Custom Install Directory use a variable, and I also created a test config file that has variables that will need replacing when it deploys to Production.
So I have used the Substitute Variables in Files feature and defined my config.php
file.
All three variables, for my Custom Installation Directory, and my two variables in the config.php
file.
Time to Deploy
Now that my package is chosen as a step, and my variables are configured and scoped, it is time to test a release. I guess I should create one!
Deployment time!
And here is the deployment log for the package:
Results on Server
And we are done, Octopus has deployed my PHP files. So let’s have a look at the results. Here is my lovely phpinfo()
page.
And my files are deployed in the correct location on my IIS Server.
We also cannot forget about my config.php
which has had it’s variables nicely substituted.
Complete Success
So my deployment of PHP files onto an IIS Server was a complete success. I was able to use everything that Octopus already did, the only thing I had to do manually was create my package, but it really is a case of ‘find a folder and add’. Yes this deployment was an an IIS Server, and mostly PHP is run on Linux, but maybe that deployment reality really isn’t too far from our future.
Tags:
Related posts

Configuration Management with Octopus and PowerShell DSC
At Octopus Deploy we keep rattling on about how Octopus is API first. One of the benefits of being API first is that you can do anything that the Octopus UI does via web requests.

Tenant aware lifecycles
Let's take a look at how the inclusion of tenants influences the deployment Lifecycle process.

The Power of Configuration Transformations
It is a common scenario to perform different configuration transforms depending on the Environment that is being deploying to.