As you have probably read by now, my background pre-Octopus was PHP in a LAMP environment. Doing system administration duties manually releasing and deploying PHP sites. So when a customer recently asked if they could deploy a PHP site to IIS, Paul in his wisdom asked me to write up a blog post about just that.
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
All three variables, for my Custom Installation Directory, and my two variables in the
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!
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
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.
So my deployment of PHP files onto an IIS Server was a complete success. I was able to utilise 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.
Octopus Deploy is used by thousands of developers across the globe, from small companies to large enterprises. Find out if it meets your deployment automation needs by taking advantage of our free 30-day trial. You can spin up an instance with just a few clicks!